-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
bpo-36231: Support building on macOS without /usr/include #13773
bpo-36231: Support building on macOS without /usr/include #13773
Conversation
Thanks @ned-deily for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.7. |
Sorry, @ned-deily, I could not cleanly backport this to |
Sorry @ned-deily, I had trouble checking out the |
|
GH-14208 is a backport of this pull request to the 3.7 branch. |
GH-14256 is a backport of this pull request to the 2.7 branch. |
Apple has been trying to discourage the use of installing and compiling with system header files in
/usr/include
. Instead, the favored approach is to use header files from within a macOS SDK. For the most part, the Apple-supplied toolchain handles this transparently as long as the toolchain is doing the searching for header files. Unfortunately, the top-levelsetup.py
used to build the Python interpreter does some searching for various header files on its own and, with the removal in macOS 10.14 of the option to install system headers, the Python build may now fail to build several standard library modules that depend on third-party libraries shipped with macOS, for example, sqlite3.The search behavior of the toolchain is also conditioned by the setting of various environment variables or by the use of
xcrun
, i.e. it is possible to change SDK locations at build time (man xcrun
has more information). And non-Apple compilers might be in use soxcrun
might not give the correct results. If an SDK is not explicitly specified at./configure
time or viaCFLAGS
, the solution used here is to rely on using the-v
output from the compiler preprocessor to find the include file paths that are actually being used (this technique is used elsewhere insetup.py
) and from them derive an SDK root forsetup.py
to use in its searches. There is a bit of a bootstrap issue in that much of the standard library is not yet available whensetup.py
is running (it's trying to build the non-builtin modules) so the code here has to make do with a few hacks.https://bugs.python.org/issue36231