无法编译:节文本中无法识别重定位 0x2a

2024-02-09

编译“make”时我收到一条错误消息

$ make
g++ -fopenmp  -o lang.test main.o -I../../../include/Lheader -I../../../include -L../../../lib/ -llmi -lblas -lboost_regex -lpthread -lleveldb
/usr/bin/ld: ../../../lib//liblmi.a(LMInterface.o): unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

我找不到上述问题的任何解决方案。

GCC版本和ld版本是这样的:

$ gcc --version
gcc (Ubuntu 5.4.1-2ubuntu1~14.04) 5.4.1 20160904
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


$ ld --version
GNU ld (GNU Binutils for Ubuntu) 2.24
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

如何解决这个编译问题?


x86-64 上的重定位 42 是R_X86_64_REX_GOTPCRELX。这些搬迁被使用用于 binutils 2.26 及更高版本中实现的优化 https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=56ceb5b5405af23eddd12e12d8ba849010120324.

您需要升级 binutils 版本,或者重新编译要与当前工具链版本一起使用的库。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法编译:节文本中无法识别重定位 0x2a 的相关文章

随机推荐