簡體   English   中英

ld編譯時出錯:__stack_chk_guard @@ GLIBC_2.17

[英]error in compilation with ld : __stack_chk_guard@@GLIBC_2.17

我正在運行Ubuntu 16.04.1的odroidC2板(armv8-64bit)上編譯一些文件,但出現以下錯誤:

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重新編譯”。 任何想法?

問題不在於您正在使用-fPIC編譯的pd-linux/release-single/main.opp (順便說一句,也許是.cpp?)中,而是在libflext-pd_s.a包含對象libflext_pd_s_la-flxlet.o未使用-fPIC進行編譯,因此您需要正確地重新編譯flext庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM