【问题标题】:error in compilation with ld : __stack_chk_guard@@GLIBC_2.17使用 ld 编译时出错:__stack_chk_guard@@GLIBC_2.17
【发布时间】:2016-08-12 19:54:00
【问题描述】:

我正在运行 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重新编译”。有什么想法吗?

【问题讨论】:

    标签: c++ linux gcc g++ odroid


    【解决方案1】:

    问题不在于您使用-fPIC 编译的pd-linux/release-single/main.opp(顺便说一句,也许是.cpp?),而是在包含对象libflext_pd_s_la-flxlet.olibflext-pd_s.a 存档中,该对象未使用@ 编译987654325@,所以需要重新编译flext库。

    【讨论】:

      猜你喜欢
      • 2019-03-13
      • 1970-01-01
      • 1970-01-01
      • 2011-10-02
      • 2019-07-19
      • 1970-01-01
      • 1970-01-01
      • 2013-03-25
      • 1970-01-01
      相关资源
      最近更新 更多