Skip to content
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

Provide aarch64 wheel for windows #237

Open
saschanaz opened this issue Aug 21, 2024 · 8 comments · May be fixed by #246
Open

Provide aarch64 wheel for windows #237

saschanaz opened this issue Aug 21, 2024 · 8 comments · May be fixed by #246

Comments

@saschanaz
Copy link

It would be nice to set up CI for aarch64 windows wheel.

@saschanaz
Copy link
Author

Looks like it'll take a few months to openly access windows arm64 runner: https://github.blog/news-insights/product-news/arm64-on-github-actions-powering-faster-more-efficient-build-systems/

@glandium
Copy link
Contributor

glandium commented Dec 19, 2024

I tried cross-compiling with cibuildwheel, but that didn't work. I ended up with an arm64 wheel containing an amd64 module. Compiling natively works (except for #240), but arm64 GHA workers are only available on Enterprise.

@saschanaz
Copy link
Author

Might be related to pypa/cibuildwheel#1942 ?

@glandium
Copy link
Contributor

So, it turns out it's properly cross compiling... but the files "just" have the wrong name:

$ file zstandard/*.pyd 
zstandard/_cffi.cp311-win_amd64.pyd:     PE32+ executable (DLL) (GUI) Aarch64, for MS Windows, 6 sections
zstandard/backend_c.cp311-win_amd64.pyd: PE32+ executable (DLL) (GUI) Aarch64, for MS Windows, 6 sections

@glandium
Copy link
Contributor

So, the VSCMD_ARG_TGT_ARCH mentioned in the cibuildwheel issue is taken into account here:
https://github.com/python/cpython/blob/v3.11.11/Lib/distutils/util.py#L101-L106

which... doesn't support arm64.
So let's look at its fallback, get_host_platform... which allows to set _PYTHON_HOST_PLATFORM:
https://github.com/python/cpython/blob/v3.11.11/Lib/distutils/util.py#L48-L50

But guess what... this is what comes before that block:
https://github.com/python/cpython/blob/v3.11.11/Lib/distutils/util.py#L39-L46

The replacement for that, sysconfig.get_platform has the same problem:
https://github.com/python/cpython/blob/v3.13.1/Lib/sysconfig/__init__.py#L603-L618

@saschanaz
Copy link
Author

FWIW, as python 3.12 removed distutils, it's been maintained as part of setuptools, including the fix for get_platform: pypa/distutils@f15f814

Perhaps we should make sure cibuildwheel doesn't depend on python distutils?

@glandium
Copy link
Contributor

So, turns out the file name for modules ultimately comes from sysconfig.get_config_var("EXT_SUFFIX") in https://github.com/pypa/setuptools/blob/v75.6.0/setuptools/_distutils/command/build_ext.py#L711-L720

The equivalent setuptools code has an escape hatch via an environment variable:
https://github.com/pypa/setuptools/blob/v75.6.0/setuptools/command/build_ext.py#L161-L186

But that also means we can probably trick it from setup.py.

@glandium
Copy link
Contributor

I got something to work.

@glandium glandium linked a pull request Dec 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants