-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
On macOS 10.15/Python3.9.1 build_ext, bdist_wheel produce x86_64-only extensions with 'universal2' tag #2520
Comments
There is an upstream bug report for this, https://bugs.python.org/issue42619. |
The upstream issue contains some more information on the background, in particular a comment in _osx_support.py (in the standard library) that says:
The side effect of that behaviour is that the sysconfig.get_platform() for a universal build will always return the platform tag for that universal build, even if the current machine cannot build for some of those architectures. I haven't done further research on this and don't know why using a correct tag would cause problems. |
Apple clang is too randomly broken (no operator<=> for std::string, seriously?), so this needs GCC. Also, there were some non-fatal warnings about a mismatch of "deployment target", so I figured out that I probably need to use the latest and greatest to limit the blast size when stuff breaks. Fingers crossed; these blind builds really take a leap of faith. Since Apple clang is not enough and the bundled GCC is not a cross-compiler (and I don't really feel like bootstrapping one today), we cannot build arm64 binaries on Mac OS yet. That required another fair amount of hoop jumping due to pypa/wheel#406 and/or pypa/setuptools#2520.
Apple clang is too randomly broken (no operator<=> for std::string, seriously?), so this needs GCC. Also, there were some non-fatal warnings about a mismatch of "deployment target", so I figured out that I probably need to use the latest and greatest to limit the blast size when stuff breaks. Fingers crossed; these blind builds really take a leap of faith. But the resulting CPython module loads successfully, so I suppose this might actually work? Since Apple clang is not enough and the bundled GCC is not a cross-compiler (and I don't really feel like bootstrapping one today), we cannot build arm64 binaries on Mac OS yet. But the Python version that is driving this build is the `universal2` fat binary thingy, and due to pypa/wheel#406 and/or pypa/setuptools#2520, this required another fair amount of hoop jumping. Finally, the BSD-ish userland comes with its set of peculiarities.
Apple clang is too randomly broken (no operator<=> for std::string, seriously?), so this needs GCC. Also, there were some non-fatal warnings about a mismatch of "deployment target", so I figured out that I probably need to use the latest and greatest to limit the blast size when stuff breaks. Fingers crossed; these blind builds really take a leap of faith. But the resulting CPython module loads successfully, so I suppose this might actually work? Since Apple clang is not enough and the bundled GCC is not a cross-compiler (and I don't really feel like bootstrapping one today), we cannot build arm64 binaries on Mac OS yet. But the Python version that is driving this build is the `universal2` fat binary thingy, and due to pypa/wheel#406 and/or pypa/setuptools#2520, this required another fair amount of hoop jumping. Finally, the BSD-ish userland comes with its set of peculiarities.
Environment
Observation
Compiling a C extension via
build_ext
(and packaging them viabdist_wheel
) results in x86_64 only shared objects, but the Interpreter's platform taguniversal2
is used in the wheel's tag nontheless. For me the expected behaviour is that the platform tag being used is 'x64_64', because the shared object does not have a arm64 slice. I know that I can manually override the 'universal2' tag in the wheel, but this default choice seems odd here.Minimal example to reproduce:
File
hello.c
:File
setup.py
:Commands:
Further discussion
On macOS 10.15 is it possible to cross compile for arm64, too, if a recent enough Xcode version (>=12.2) and the appropriate macOS SDK (>= 11.0) is used. So technically it is possible create truly universal2 extensions with that OS (but
-arch arm64
would need to be added to the CFLAGS then). In the example above however, the invocation of 'gcc' results in the macOS 10.15 SDK being used, and the result can only be a x86_64 binary.Pinging @ronaldoussoren who has done a lot of work for the universal2 integration.
The text was updated successfully, but these errors were encountered: