Search code examples
macoscompilationcpython

Why I cannot compile CPython?


I'm trying to compile CPython, specifically tag 3.9.0

( git checkout tags/v3.9.0 -b v3.9.0)

I'm following the instructions from the book CPython Internals by Real Python.

When I tried to compile with:

CPPFLAGS="-I$(brew --prefix zlib)/include" \
 LDFLAGS="-L$(brew --prefix zlib)/lib" \
 ./configure --with-openssl=$(brew --prefix openssl) \
 --with-pydebug --enable-framework

I received the error: configure: error: internal configure error for the platform triplet; please file a bug report.

Here is a screenshot :

enter image description here

This is my system:

enter image description here

Any help will be appreciated it.


Solution

  • It appears to be a bug which is raised with the github issue configure fails on macOS with non-Apple clang version 13 which implements --print-multiarch. As per update python to 3.9.12 to fix Clang issue on macOS a fix has been applied in python 3.9.12 branch.

    So you have to git checkout tags/v3.9.12 -b v3.9.12 and run the build script again to build the python version 3.9 in MacOS Monterey.