使用ld: __stack_chk_guard@@GLIBC_2.17编译错误



我正在编译运行Ubuntu 16.04.1的odroidC2板(armv8-64位)上的一些文件,并且我得到了以下错误:

odroid@odroid64:~/flext-master/tutorial/simple1$ g++ -fPIC -L/usr/lib -pthread -shared -Wl,-S -L/usr/local/src/pd/bin -L/usr/local/lib -o pd-linux/release-single/simple1.pd_linux   pd-linux/release-single/main.opp  -lflext-pd_s 
/usr/bin/ld: /usr/local/lib/libflext-pd_s.a(libflext_pd_s_la-flxlet.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `__stack_chk_guard@@GLIBC_2.17' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /usr/local/lib/libflext-pd_s.a(libflext_pd_s_la-flxlet.o)(.text+0x344): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

可以看到-fPIC选项是存在的。所以我不明白为什么编译器建议"用-fPIC重新编译"。任何想法?

问题不在于pd-linux/release-single/main.opp (BTW,也许。cpp?),你正在用-fPIC编译,但在libflext-pd_s.a存档,包含一个对象libflext_pd_s_la-flxlet.o没有用-fPIC编译,所以你需要重新编译flext库正确

最新更新