【发布时间】:2015-03-17 22:10:01
【问题描述】:
我正在使用 Boost 1.57.0
我是用下面的命令编译的
sudo ./b2 install --prefix=/home/sumkin/boost_build cxxflags='-fPIC' link=static
当我将共享库编译到我想静态链接 boost 的位置时,出现以下错误
/usr/bin/ld: /home/sumkin/boost_build/lib/libboost_filesystem.a(operations.o):
relocation R_X86_64_32 against `.rodata.str1.1' can not
be used when making a shared object; recompile with -fPIC
/home/sumkin/boost_build/lib/libboost_filesystem.a: error adding
symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libhtkernel.so] Error 1
make[1]: *** [CMakeFiles/htkernel.dir/all] Error 2
make: *** [all] Error 2
我做错了什么?我在 x86_64-linux-gnu 上。
【问题讨论】:
-
您是否使用 -fPIC 选项编译您的共享库?
-
上面可以看到cxxflags='-fPIC'
-
是的,但我看到它们用于编译 Boost 库,而不是用于“当我编译共享库时”引用的共享库