-
Notifications
You must be signed in to change notification settings - Fork 4
Building PYCC for MacOS issues
Used MacOS: Catalyna
The ref to Python lib is defined in src/Makefile.am Be careful it defines both version numbers (3.n), you should install the exact version as default. It was initially set by -lpython3.6m but I changed it to 3.7 as 3.6 installation is not directly supported on my MacOS.
To make headers like "Python.h" available for the compiler I added
-L /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/headers
to CPPFLAGS var in build-mac.sh
When komodod is built it could not load with an error 'Python3 could not be found'. The otool -L komodod
showed that a dylib relative dependency to the python3 was added: @rpath/Python3.framework/Versions/3.7/Python3
. To resolve it I added -Wl,-rpath,/Library/Developer/CommandLineTools/Library/Frameworks
to CXXFLAGS var in build-mac.sh
When I built pycc.so running make it ended with a lot of errors like
"_PyImport_ExecCodeModuleEx", referenced from:
pyo3::types::module::PyModule::from_code::h5221d5256e3ab9a9 in libpyo3-a79a90d0681fac3f.rlib(pyo3-a79a90d0681fac3f.pyo3.dl3qelwn-cgu.9.rcgu.o)
The solution for Mac was found here: https://github.com/PyO3/pyo3, to create a ~/.cargo/config with params
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]