beeware / Python-Apple-support

A meta-package for building a version of Python that can be embedded into a macOS, iOS, tvOS or watchOS project.
MIT License
1.1k stars 159 forks source link

build for macos failed on macos 12.3.1 with Xcode13.3.1 #141

Closed kasimok closed 2 years ago

kasimok commented 2 years ago

Describe the bug

make all failed on macOS.

To Reproduce Steps to reproduce the behavior:

  1. Clone the repo
  2. checkout to 3.9 branch
  3. execute make
  4. See error below
cat /Users/xxx/Downloads/Python-Apple-support/patch/Python/Setup.embedded /Users/xxx/Downloads/Python-Apple-support/patch/Python/Setup.macOS > build/macOS/Python-3.9.6-macOS/Modules/Setup.local
# Configure target Python
cd build/macOS/Python-3.9.6-macOS && MACOSX_DEPLOYMENT_TARGET=10.8 ./configure --prefix=/Users/xxx/Downloads/Python-Apple-support/build/macOS/Python-3.9.6-macOS/dist --without-doc-strings --enable-ipv6 --without-ensurepip --enable-universalsdk --with-universal-archs=universal2
checking build system type... x86_64-apple-darwin21.4.0
checking host system type... x86_64-apple-darwin21.4.0
checking for python3.9... python3.9
checking for --enable-universalsdk... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
checking for --with-universal-archs... universal2
checking MACHDEP... "darwin"
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for a sed that does not truncate output... /usr/bin/sed
checking for --with-cxx-main=<compiler>... no
checking for g++... no
configure:

  By default, distutils will build C++ extension modules with "g++".
  If this is not intended, then set CXX on the configure command line.

checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** [build/macOS/Python-3.9.6-macOS/Makefile] Error 1

Expected behavior build succeeds Screenshots If applicable, add screenshots to help explain your problem.

Environment:

Additional context

ColdGrub1384 commented 2 years ago

Changing the compiler to GCC solves the problem for me (export CC=$(which gcc-11)), but then there are problems with __builtin_available which is exclusive to clang. So you can set CC back to clang after running configure by modifying the generated Makefile in build/macOS/Python-3.10.0-macOS. I'm not sure how to really fix it but I think it's a problem with Python, not only this project. https://bugs.python.org/issue44065

kasimok commented 2 years ago

Changing the compiler to GCC solves the problem for me (export CC=$(which gcc-11)), but then there are problems with __builtin_available which is exclusive to clang. So you can set CC back to clang after running configure by modifying the generated Makefile in build/macOS/Python-3.10.0-macOS. I'm not sure how to really fix it but I think it's a problem with Python, not only this project. https://bugs.python.org/issue44065

Yes, incompatible comes from apple clang with standard gcc. Thanks for the solution.