c++ - 使用 ld : __stack_chk_guard@@GLIBC_2. 17 编译时出错

标签 c++ linux gcc g++ odroid

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

最佳答案

问题不在您使用 -fPIC 编译的 pd-linux/release-single/main.opp(顺便说一句,也许是 .cpp?) , 但在包含对象 libflext_pd_s_la-flxlet.olibflext-pd_s.a 存档中,它不是用 -fPIC 编译的,所以你需要正确地重新编译 flex 库。

关于c++ - 使用 ld : __stack_chk_guard@@GLIBC_2. 17 编译时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38925569/

相关文章:

php - 以 root 身份运行 php 脚本

c++ - GCC 和 Clang 之间的不同行为

动态lib(.so)版本的兼容性

c++ - 使用 Ogre3d 的自定义流/streambuf 有不明确的过载错误

c++ - 如何像 java 一样迭代 C++ 中的枚举?

c++ - 在整数 std::chrono::durations 之间转换

linux - 在 Linux 上使用静态链接构建应用程序是否明智?

c# - C# 和 Java 中的泛型与 C++ 中的模板有什么区别?

linux - 什么是 "Memory Page out Rate"

linux - 使用 'sh' 运行脚本时无法使用内置 bash 命令