交叉编译libpcre遇到的Relocations in generic ELF (EM: 183)问题

这篇博客主要讨论了在编译过程中遇到的错误,即`/usr/bin/ld`报告libpcre.a(libpcre_la-pcre_compile.o)中的Relocations in generic ELF (EM: 183)问题。作者提到了libtool在管理库依赖时的作用,并展示了如何通过修改libdir路径来解决这个问题。最终,通过修正所有相关文件并重新运行make命令,成功解决了编译错误。

遇到如下报错

/usr/bin/ld: /home/ces_netconf/pcre-8.44/arm_build/.libs/libpcre.a(libpcre_la-pcre_compile.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/ces_netconf/pcre-8.44/arm_build/.libs/libpcre.a(libpcre_la-pcre_compile.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/ces_netconf/pcre-8.44/arm_build/.libs/libpcre.a(libpcre_la-pcre_compile.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/ces_netconf/pcre-8.44/arm_build/.libs/libpcre.a(libpcre_la-pcre_compile.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/ces_netconf/pcre-8.44/arm_build/.libs/libpcre.a(libpcre_la-pcre_compile.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/ces_netconf/pcre-8.44/arm_build/.libs/libpcre.a(libpcre_la-pcre_compile.o): Relocations in generic ELF (EM: 183)
/usr/bin/ld: /home/ces_netconf/pcre-8.44/arm_build/.libs/libpcre.a(libpcre_la-pcre_compile.o): Relocations in generic ELF (EM: 183)
/home/ces_netconf/pcre-8.44/arm_build/.libs/libpcre.a: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
Makefile:1599: recipe for target 'pcrecpp_unittest' failed
make[1]: *** [pcrecpp_unittest] Error 1
make[1]: Leaving directory '/home/ces_netconf/pcre-8.44/arm_build'
Makefile:1403: recipe for target 'all' failed
make: *** [all] Error 2

关于libtool:
libtool的资料:libtool主要的一个作用是在编译大型软件的过程中解决了库的依赖问题;将繁重的库依赖关系的维护工作承担下来,从而释放了程序员的人力资源。 libtool提供统一的接口,隐藏了不同平台间库的名称的差异等细节,生成一个抽象的后缀名为la高层库libxx.la(其实是个文本文件),并将该库对其它库的依赖关系,都写在该la的文件中。该文件中的

dependency_libs记录该库依赖的所有库(其中有些是以.la文件的形式加入的);

libdir则指出了库的安装位置;
library_names记录了共享库的名字;old_library记录了静态库的名字。


打开libmysqlclient.la
dlname='libstdc++.so'
libdir='/usr/local/lib'
这里,libstdc++指定了上边的dlname文件所在的路径,改为正确的
libdir='/usr/arm64/aarch64-linux-gnu/aarch64-linux-gnu/lib64'
把所有报错的文件都改一下,再次make,ok了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值