我知道这里没有多少人有心灵感应能力,但我会尽力提供尽可能多的信息,以便有人可以帮助我调试我正在尝试编译的某些程序中的链接器错误。
因此,该程序是 cilkprof
(请参阅 here,警告:tgz 文件)。其中有一个 Makefile
,我仅将 var CXX = icpc
更改为 CXX = g++
。其他一切都是平等的。
/usr/bin/ld: ../../3rdparty/pintool/intel64/lib/libpin.a(util_host_ia32e.os):
relocation R_X86_64_PC32 against symbol `DoXsave' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make: *** [linux64/cilkprof.so] Error 1
我知道我应该理解 libpin.a
应该使用 -fPIC
重新编译,但我拥有的引脚版本已经编译。知道我可能做错了什么吗?如果有什么不清楚的地方请询问。谢谢。
最佳答案
在我看来,Makefile 正在尝试构建一个共享库并将其链接到一个静态非 PIC 库,据我所知,这是你做不到的。因此,如果您无法使用 -fPIC
重新编译库,那么我看到的唯一解决方案是修改 Makefile 并构建一个静态库。
关于c - 链接器错误 : what could be going on?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13432119/