參考資訊:
https://stackoverflow.com/questions/42582712/relocation-r-x86-64-32s-against-py-notimplementedstruct-can-not-be-used-when
問題如下:
[ 35%] Linking CXX shared module pytrellis.so /usr/bin/ld: /usr/local/lib/libpython3.11.a(abstract.o): relocation R_ARM_THM_MOVW_ABS_NC against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libpython3.11.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status CMakeFiles/pytrellis.dir/build.make:312: recipe for target 'pytrellis.so' failed make[2]: *** [pytrellis.so] Error 1 CMakeFiles/Makefile2:120: recipe for target 'CMakeFiles/pytrellis.dir/all' failed make[1]: *** [CMakeFiles/pytrellis.dir/all] Error 2 Makefile:135: recipe for target 'all' failed make: *** [all] Error 2
解法如下:
編譯Python3時,使用--enable-shared配置