7starsea / vnpy3

vnpy3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

编译时遇到R_X86_64_PC32 问题

cooooo opened this issue · comments

系统环境

Ubuntu1804,anaconda3, py3.6x64,boost1.65, cmake3.10

问题

/usr/bin/x86_64-linux-gnu-ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libboost_thread.a(thread.o): 
relocation R_X86_64_PC32 against symbol `_ZN5boost6detail15sp_counted_base7destroyEv'
 can not be used when making a shared object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
api/ctp/vnctpmd/CMakeFiles/vnctpmd.dir/build.make:103: recipe for target '../../api/ctp/vnctpmd.so' failed
make[2]: *** [../../api/ctp/vnctpmd.so] Error 1
CMakeFiles/Makefile2:106: recipe for target 'api/ctp/vnctpmd/CMakeFiles/vnctpmd.dir/all' failed
make[1]: *** [api/ctp/vnctpmd/CMakeFiles/vnctpmd.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

请问该如何处理?

commented

Two solutions:

  1. use dynamic boost libraries (.so) instead of statically
  2. recompile boost libraries with flag -fPIC

@7starsea 谢谢指导!
重新编译安装boost之后,编译通过,无报错。