MacOS: skip bundled libffi on non-x86_64#342
Open
bjia56 wants to merge 3 commits intopython-cmake-buildsystem:masterfrom
Open
MacOS: skip bundled libffi on non-x86_64#342bjia56 wants to merge 3 commits intopython-cmake-buildsystem:masterfrom
bjia56 wants to merge 3 commits intopython-cmake-buildsystem:masterfrom
Conversation
Contributor
Author
|
I see from the CI tests that this ended up disabling ctypes on regular x86_64 macos, will tweak to restore prior behavior. |
|
What's the status on this? I was about to do a PR doing exactly the same thing, but then found out you already did it. |
theartful
reviewed
Sep 14, 2025
| ${SRC_DIR}/Modules/_ctypes/darwin | ||
| DEFINITIONS MACOSX | ||
| ) | ||
| if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64") |
There was a problem hiding this comment.
I'm testing this PR, and trying to build python on an arm macos for x86_64, and then for arm64 (I made a wrong review that I deleted before, disregard it if you saw it).
I failed locally to build for x86_64 on an arm machine (ctypes didn't work), since I get CMAKE_SYSTEM_PROCESSOR = arm64, while CMAKE_OSX_ARCHITECTURES = x86_64.
I think it's better to check only for CMAKE_OSX_ARCHITECTURES
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When cross compiling for arm64 Macs, the bundled cpython libffi throws an unsupported cpu error. This change makes it so that Mac compilation skips the bundled libffi if a system libffi was requested.
This change also now makes it possible to build universal python binaries for x86_64/arm64, though that also requires pre-compiling dependencies (including libffi) from source for both architectures.