C++链接报错:which may bind externally can not be used when making a shared object; recompile with -fPIC

Posted Dontla

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C++链接报错:which may bind externally can not be used when making a shared object; recompile with -fPIC相关的知识,希望对你有一定的参考价值。

ngrest kyai编译运行的时候报错了

root@ubuntu:/kyai_nv# Building project kyai...
make[2]: Warning: File 'kyai/CMakeFiles/kyai.dir/flags.make' has modification time 30937670 s in the future
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
make[2]: Warning: File 'kyai/CMakeFiles/kyai.dir/flags.make' has modification time 30937670 s in the future
/usr/bin/ld: /userdata/temp/libky_ai_socket.a(ky_ai_socket.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `filename' which may bind externally can not be used when making a shared object; recompile with -fPIC
/userdata/temp/libky_ai_socket.a(ky_ai_socket.o): In function `ky_ai_restart_algo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
ky_ai_socket.cpp:(.text+0xe68): dangerous relocation: unsupported relocation
/usr/bin/ld: /userdata/temp/libky_ai_socket.a(ky_ai_socket.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_ZGVZ9KY_AI_LOGIA23_cJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA2_cEEvRKT_DpRKT0_E10s_ky_ai_fs' which may bind externally can not be used when making a shared object; recompile with -fPIC
/userdata/temp/libky_ai_socket.a(ky_ai_socket.o): In function `void KY_AI_LOG<char [23], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [2]>(char const (&) [23], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [2])':
ky_ai_socket.cpp:(.text._Z9KY_AI_LOGIA23_cJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA2_cEEvRKT_DpRKT0_[_Z9KY_AI_LOGIA23_cJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA2_cEEvRKT_DpRKT0_]+0x2c): dangerous relocation: unsupported relocation
/usr/bin/ld: /userdata/temp/libky_ai_socket.a(ky_ai_socket.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `_ZGVZ9KY_AI_LOGIA23_cJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEA2_cEEvRKT_DpRKT0_E10s_ky_ai_fs' which may bind externally can not be used when making a shared object; recompile with -fPIC

解决方法:
同C/C++链接静态库报错:dangerous relocation: unsupported relocation(-fPIC)

以上是关于C++链接报错:which may bind externally can not be used when making a shared object; recompile with -fPIC的主要内容,如果未能解决你的问题,请参考以下文章

May 16th 2017 Week 20th Tuesday

git commit报错报错信息:type may not be empty [type-empty] subject may not be empty [subject-empty]

git commit报错报错信息:type may not be empty [type-empty] subject may not be empty [subject-empty]

FlinkFlink 报错 Initial AbstractPagedOutputView Segment may not be null

idea Debug 报错 : Method breakpoints may dramatically slow down debugging

mybatis报错:The error may exist in xxxxMapper.xml