[issue46248] Compilation errors on macOS

Ned Deily report at bugs.python.org
Mon Jan 3 15:26:26 EST 2022


Ned Deily <nad at python.org> added the comment:

Thanks for the report. Without more details, we can only guess at what you are trying to accomplish. I would assume it involves embedding Python in another library or application. If so, you should not be using LINKFORSHARED at all which is used to build Python itself (see, for example, Issue36508). Moreover, when embedding on macOS, we do not recommend trying to use the -framework argument to compile with or link to Python: it's too easy to get wrong. Instead, as shown in the use the "Extending and Embedding the Python Interpreter" section of the docset, use the output from the appropriate python3.x-config command, for example:

$ python3.10-config --cflags
-I/Library/Frameworks/Python.framework/Versions/3.10.1_11/include/python3.10 -I/Library/Frameworks/Python.framework/Versions/3.10.1_11/include/python3.10 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g

$ python3.10-config --ldflags
-L/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/config-3.10-darwin -ldl -framework CoreFoundation

https://docs.python.org/3/extending/embedding.html#compiling-and-linking-under-unix-like-systems

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46248>
_______________________________________


More information about the Python-bugs-list mailing list