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

[darwin] pre-built artifacts reference SDK path from the build host #144

Open
f355 opened this issue Oct 25, 2022 · 3 comments
Open

[darwin] pre-built artifacts reference SDK path from the build host #144

f355 opened this issue Oct 25, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@f355
Copy link

f355 commented Oct 25, 2022

In darwin artifacts downloaded from the release page, the file lib/python3.10/_sysconfigdata__darwin_darwin.py contains the following flag:

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk

If the machine has only Command Line Tools installed, then trying to install any pip package that has C code in it fails with the following error:

  running build_ext
  creating build/temp.macosx-11.0-arm64-3.10
  creating build/temp.macosx-11.0-arm64-3.10/src
  Compiling with an SDK that doesn't seem to exist: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
  Please check your Xcode installation

...

  clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk' [-Wmissing-sysroot]
  In file included from src/MD2.c:28:
  src/common.h:34:10: fatal error: 'stdio.h' file not found
  #include <stdio.h>
           ^~~~~~~~~
  1 error generated.
  error: command '/usr/bin/clang' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pycryptodomex

The situation gets worse with upgrading XCode to 14.1 as it no longer includes MacOSX12.3.sdk, at least in the Release Candidate 2.

@f355
Copy link
Author

f355 commented Oct 25, 2022

I was able to work around this by running ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk, but that makes me feel dirty.

@indygreg
Copy link
Owner

indygreg commented Nov 9, 2022

It is a known problem that build-time paths leak into the distribution.

See https://gregoryszorc.com/docs/python-build-standalone/main/quirks.html#references-to-build-time-paths.

I wish I had a better solution for you, but I don't at this time. This is a complex problem with no easy solutions. The best I can recommend is for you to manually patch the bad _sysconfigdata_*.py file post extraction. This is something I hope we can make turnkey one day.

@indygreg indygreg added the bug Something isn't working label Nov 9, 2022
@f355
Copy link
Author

f355 commented Nov 9, 2022

oh well. thank you anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants