Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enable windows/arm64 platform #22429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 14, 2022
Merged

Conversation

niyas-sait
Copy link
Contributor

@niyas-sait niyas-sait commented Feb 8, 2022

The patch adds support for building matplotlib for windows on arm64 platforms with FreeType 2.11.

  • Changes to compile with FreeType 2.11.1
  • Add MSBuild platform selection for ARM64
  • Add support for static builds for FreeType versions 2.10 and above

Few tests fail on windows on arm target due to minor mismatches in reference images used for the test. This seems to be due to the FreeType version upgrade required for win/arm64 platform. Similar tests are failing for win/x64 as well with the latest FreeType. Reference images probably need to be upgraded with the latest FreeType for all of them to pass correctly.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@tacaswell
Copy link
Member

Why does ARM require freetype 2.11.0?

I would quible a bit with the wording of "support", we have always supported newer versions of freetype (and the linux distributions regularly ship Matplotlib with newer versions), but due to changes in the text layout, many of our tests will fail if you do not user FT2.6.1.

@niyas-sait
Copy link
Contributor Author

Why does ARM require freetype 2.11.0?

Freetype cannot be built for arm64 for earlier versions. MSBuild configurations were missing.

I would quible a bit with the wording of "support", we have always supported newer versions of freetype (and the linux distributions regularly ship Matplotlib with newer versions), but due to changes in the text layout, many of our tests will fail if you do not user FT2.6.1.

Yes, Freetype 2.11.0 seems to generate libraries in a slightly different place, and had to tweak the matplotlib scripts a bit to fix it. That's why I have used the wording supported :-) Happy to change it

@niyas-sait
Copy link
Contributor Author

@tacaswell CI failures seem to be unrelated (looks like a known issue around ghost scripts based on the discussion on gitter). Could you review the patch please?

@@ -1199,7 +1200,9 @@ def is_interactive():
def _init_tests():
# The version of FreeType to install locally for running the
# tests. This must match the value in `setupext.py`
LOCAL_FREETYPE_VERSION = '2.6.1'
win_arm64 = sys.platform.startswith('win') and \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you drop this change? Even if the default freetype we will try to build on arm64 in 2.11.1, it is still true that the tests will fail (due to changes in the font rendering) so we should still provide this warning.

I suspect that this (local) variable should have been called VERSION_OF_FREETYPE_THE_TESTS_WORK_WITH ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that make sense 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a commit to revert that part.

@oscargus oscargus added status: needs workflow approval For PRs from new contributors, from which GitHub blocks workflows by default. OS: Microsoft labels Feb 17, 2022
@tacaswell tacaswell added this to the v3.5.2 milestone Feb 18, 2022
@tacaswell
Copy link
Member

@QuLogic Any reason to not pull this back for 3.5.2?

@niyas-sait
Copy link
Contributor Author

codecov tests don't seem happy now! It is not flagging any particular lines. Could it be a rebase issue?

@tacaswell
Copy link
Member

codecov can lag a bit based on when CI jobs finish. We need all of the jobs to get the full coverage, but codecov will update the issue when it gets most of them.

@QuLogic
Copy link
Member

QuLogic commented Feb 25, 2022

Freetype cannot be built for arm64 for earlier versions. MSBuild configurations were missing.

What exactly is the failure? We don't use MSBuild to build bundled FreeType.

@niyas-sait
Copy link
Contributor Author

Freetype cannot be built for arm64 for earlier versions. MSBuild configurations were missing.

What exactly is the failure? We don't use MSBuild to build bundled FreeType.

Previous FreeType versions didn't have the ARM64 specific build configurations.

Don't we use freetype.sln to build FreeType as part of building extensions ? (ref:setupext.py, line 594, do_custom_build)

@QuLogic
Copy link
Member

QuLogic commented Feb 25, 2022

No, you're right, I forgot that happens on Windows.

@niyas-sait
Copy link
Contributor Author

Can this be merged?

@tacaswell
Copy link
Member

@nsait-linaro I do not fully understand what is going on at the bottom? It looks like it will grab the last path that last path that matches? Do we expect there to ever be more than one path that matches and/or can that path be directly constructed again?

@niyas-sait
Copy link
Contributor Author

@nsait-linaro I do not fully understand what is going on at the bottom? It looks like it will grab the last path that last path that matches? Do we expect there to ever be more than one path that matches and/or can that path be directly constructed again?

@tacaswell There should be only one match as we are building only specific platform at a time. I have done a bit of refactoring to reflect that.

msbuild_platform = (
'x64' if platform.architecture()[0] == '64bit' else 'Win32')
base_path = Path("build/freetype-2.6.1/builds/windows")
is_x64 = platform.architecture()[0] == '64bit'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much clearer 👍🏻

@tacaswell
Copy link
Member

Thank you @nsait-linaro !

I'll merge this as soon as CI finishes.

@tacaswell
Copy link
Member

@QuLogic do you have any idea what is going on with the flake8 linter?

@niyas-sait
Copy link
Contributor Author

@QuLogic do you have any idea what is going on with the flake8 linter?

Is the 79 character limit per line intentional? I think changes used to pass CI before so I guess a new restriction.

@tacaswell
Copy link
Member

Is the 79 character limit per line intentional?

Yes and this has been our standard for longer than I have been with the project.

@niyas-sait
Copy link
Contributor Author

Is the 79 character limit per line intentional?

Yes and this has been our standard for longer than I have been with the project.

OK. Fixed that. Good to go

@tacaswell tacaswell merged commit d7828f3 into matplotlib:main Mar 14, 2022
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 14, 2022
@tacaswell
Copy link
Member

Thank you @nsait-linaro !

Congratulations on what I think is your first merged Matplotlib PR 🎉 Hopefully we will hear from you again.

@niyas-sait
Copy link
Contributor Author

Thank you @nsait-linaro !

Congratulations on what I think is your first merged Matplotlib PR 🎉 Hopefully we will hear from you again.

Thanks @tacaswell !

QuLogic pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 16, 2022
tacaswell added a commit that referenced this pull request Mar 17, 2022
…429-on-v3.5.x

Backport PR #22429 on branch v3.5.x (Enable windows/arm64 platform)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: Microsoft status: needs workflow approval For PRs from new contributors, from which GitHub blocks workflows by default.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants