编译哪个环节提升和Python库共享库,当我收到错误:删除编译器定义
/usr/bin/ld: libboost_python.a(from_python.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC libboost_python.a: could not read symbols: Bad value
我用详细模式来看看编译器的定义:
/usr/bin/c++ -fPIC -g -shared -Wl,-soname,libCore.so -o .../libCore.so Core.cpp.o -lpython2.7 -Wl,-Bstatic -lboost_python -Wl,-Bdynamic
这就是它!我必须从定义中删除-Wl, -Bstatic
但如何做到这一点?我使用cmake构建系统,这里是代码的一部分,其产生的共享库:
set(Core_SRC
Core.cpp
)
add_definitions(-g -fPIC)
add_library(Core SHARED ${Core_SRC})
target_link_libraries(Core
${PYTHON_LIBRARIES}
${Boost_LIBRARIES}
)
1.加速Python模块不能非共享库? 2.我不能建造它,因为我对这个3.对不起限制,无法理解 – Ockonal 2012-07-17 13:16:57
本:“重新编译-fPIC libboost_python.a”是告诉你,你需要做什么。如果不能重建libbost_python.a,那么你的库不能共享。 想必你的编译系统建立在轮候册给力,-Bstatic出于某种原因。如果没有,你应该有你的构建系统的维护者一个字,看看他们是否能解释为什么 – 2012-07-17 13:25:41