Reputation: 1252
I am trying to build the python-cffi project on a Apple M2 Max Macbook Pro running Sonoma from source.
When I attempt python -m build
it runs but always ends like
building '_cffi_backend' extension
creating build/temp.macosx-14-arm64-cpython-310
creating build/temp.macosx-14-arm64-cpython-310/src
creating build/temp.macosx-14-arm64-cpython-310/src/c
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -DFFI_BUILDING=1 -I/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/ffi -I/private/var/folders/b1/0rcybhys4051l25g6yvknchh00010n/T/build-env-0s3xagif/include -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.10/include/python3.10 -c src/c/_cffi_backend.c -o build/temp.macosx-14-arm64-cpython-310/src/c/_cffi_backend.o -iwithsysroot/usr/include/ffi
clang-6.0: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=14'
error: command '/usr/local/clang6/bin/clang' failed with exit code 1
I have reinstalled the xcode command line tools and selected them. Homebrew has built the corresponding libcffi with an arm64 architecture.
I assume this has something to do with the build tool chain but can't figure out why it is complaining about the deployment target which agrees with the host machine.
ETA: Interestingly if I execute just the compilation command outside the python -m build, it compiles fine without this complaint. So it must be something which is being setup by the python build system.
Upvotes: 0
Views: 467
Reputation: 1252
So I found a hint to what might be going on in the pytables project at https://github.com/PyTables/PyTables/issues/887 and more information about where the Apple binaries are supposed to be at Mac clang installation seems to override GCC install .
It appears that some older version of homebrew or another projects required installing a clang6 version at /usr/local/clang6 and having that earlier in your PATH. Thus clang was invoking an older version of the compiler which did not understand 'MACOSX_DEPLOYMENT_TARGET=14'.
I finally realized what was going on when I invoked clang6 --version
and noticed it was giving me an x86 compiler with an older version. So that is the thing to check if you are having a similar problem.
Upvotes: 0