我尝试使用boost-thread构建我的项目,但是我收到以下错误:
/usr/bin/ld.bfd.real: ./boost/boost_1_58_0/stage/lib/libboost_thread-gcc48-mt-1_58.a(thread.o): relocation R_X86_64_32 against '.text' can not be used when making a shared object; recompile with -fPIC ./boost/boost_1_58_0/stage/lib/libboost_thread-gcc48-mt-1_58.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: * * * [objdir/rel64/xerel64.so] Error 1
make[1]: Leaving directory `/home/xe'
make: * * * [build64] Error 2
我已经使用address-model=64_32 architecture=combined
和address-model=64 architecture=combined
构建了libboost_thread,并且无法正常工作。
以下是我如何构建它:
g++ -Wl,-Bsymbolic -L./lib -L./cryptopp -shared -L./mysql/lib
-L./boost/boost_1_58_0/stage/lib -shared -m64 -s -o objdir/rel64/xerel64.so
objdir/rel64/./Callbacks.o objdir/rel64/./CAnnounceBox.o objdir/rel64/./CClans.o
objdir/rel64/./CCommands.o objdir/rel64/./CCore.o objdir/rel64/./CFunctions.o
objdir/rel64/./CIRC.o objdir/rel64/./CPlayer.o objdir/rel64/./CSettings.o
objdir/rel64/./CVehicle.o objdir/rel64/./Main.o -Wl,-Bstatic -lmysqlclient64
-lcrypto64 -lboost_thread-gcc48-mt-1_58 -Wl,-Bdynamic -ldl -lpthread -lrt