Created originally on Bitbucket by standy66 (Andrew Stepanov)
Was already merged in Bitbucket before import, marked as merged by the import user
When gcc
command is present on MacOS (which is symlink to clang
by default), -undefined dynamic_lookup
and -arch
flags, which should be passed to the compiler, are overwritten in the current _sysconfigdata.py
implementation. That makes almost all C extensions fail to build on MacOS with Undefined symbols for architecture
error.
Example linker output when compiling C extension for grpc
Undefined symbols for architecture x86_64:
"_PyPyArg_UnpackTuple", referenced from:
__Pyx_Coroutine_Throw(_object*, _object*) in cygrpc.o
"_PyPyBaseObject_Type", referenced from:
__Pyx_setup_reduce(_object*) in cygrpc.o
...
"_PyPyByteArray_AsString", referenced from:
__pyx_f_4grpc_7_cython_6cygrpc_ssl_roots_override_callback(char**) in cygrpc.o
...
I swapped two blocks of code, so sys.platform[:6] == "darwin"
part operates on the result of find_executable("gcc")
part. Also appended -arch
flag to build_time_vars['CXX']
, if it is present.