-
-
Notifications
You must be signed in to change notification settings - Fork 31.3k
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
Support cross compilation on macOS #90905
Comments
Currently you get the following output:
Is "needed" for microsoft/vcpkg#22603 |
We don't currently support cross-building a single macOS architecture on another, i.e. building an x86_64 only build on an Apple Silicon Mac. However, we do support building a multi-architecture build on either on current releases of Python 3.9 and 3.10, with what is known as a universal or fat build. In this case, you'd want to add these two options: ./configure --enable-universalsdk --with-universal-archs=universal2 ... For this to succeed, you will also need to provide universal builds of any of the third-party libraries used by standard modules you need and that are not otherwise provided by macOS, the most common being OpenSSL and XZ (and perhaps newer versions of SQLite and Tcl/Tk). For the most part, those are straightforward to build yourself but also may be available through some third-party distributors like MacPorts and possibly HomeBrew. The Mac/README.rst file in repo has some more details about universal builds and there may be some useful hints at building the third-party libraries in Mac/BuildScript/build-installer.py although it is not intended to be used for this purpose. The resulting universal2 build can be used as is on either Intel-64 or Apple Silicon Macs but, if you truly need to have only Intel binaries you should be able to use the macOS lipo command to separate out the desired architecture from the built executables and shared libraries into other files. If you want to run these binaries on a range of macOS versions, you can also set the MACOSX_DEPLOYMENT_TARGET environment variable when building the libs and Python; we currently test and support back to 10.9. |
Strictly speaking, the build system does expose the ability to do a single architecture multi-architecture build - The reverse, however, is not true - there is no value for That said, the
I would question the utility of most of this. Does Python really CI on Mac OS X 10.5 (the last version to run on POWER)? That also means Xcode 3.x - with GCC 4.2. At the absolute bare minimum, there should be a value for arm64, which provides single-arch universal builds and the equivalent to cross-compilation. And AC_CHECK_SIZEOF does assume the target architecture runs on the build system (which is true for M1 Macs which can execute AMD64 Mac binaries, but the reverse isn't true) - some mild massaging of configure.ac is needed to avoid that requirement. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: