relocation R_X86_64_PC32 against,/usr/bin/ld: final link failed: Bad value

本文讲述了在编译net-snmp遇到的链接错误,重点介绍了如何通过指定--build和--host选项来解决`relocationR_X86_64_PC32`问题,以及在编译过程中正确设置默认SNMP版本。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

net-snmp编译的时候报错

/usr/bin/ld: /usr/local/lib/libnetsnmp.a(default_store.o): relocation R_X86_64_PC32 against symbol `netsnmp_ds_set_string' 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
Makefile:462: recipe for target '../blib/arch/auto/NetSNMP/default_store/default_store.so' failed
make[2]: *** [../blib/arch/auto/NetSNMP/default_store/default_store.so] Error 1
make[2]: Leaving directory '/media/build/cyf/snmp/net-snmp-5.9.1/perl/default_store'
Makefile:485: recipe for target 'subdirs' failed
make[1]: *** [subdirs] Error 2
make[1]: Leaving directory '/media/build/cyf/snmp/net-snmp-5.9.1/perl'
Makefile:299: recipe for target 'perlmodules' failed
make: *** [perlmodules] Error 1

解决方法:

./configure --build=x86_64 --host=x86_64 --with-default-snmp-version="2" --with-logfile="/var/log/snmpd.log"

指定编译平台和运行平台

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值