Unixbench安装报错信息

本文介绍了解决Unixbench在Ubuntu16.04.3环境下编译时出现的数学函数链接错误的方法。通过在Makefile文件中添加正确的数学库链接参数-lm,可以解决gcc编译过程中找不到sincos等函数的问题。

运行环境:
Ubuntu 16.04.3 x86_64
在Ubuntu下安装运行Unixbench时,提示报错信息如下

gcc -o ./pgms/ubgears -DTIME -Wall -pedantic -ansi -O2 -fomit-frame-pointer -fforce-addr -ffast-math -Wall ./src/ubgears.c -lGL -lXext -lX11
/usr/bin/ld: /tmp/ccnTgDEZ.o: undefined reference to symbol 'sincos@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:240: recipe for target 'pgms/ubgears' failed
make: *** [pgms/ubgears] Error 1

通过查阅资料,由于ubgears.c中会用到数学函数,而实际运行时找不到对应的数学函数,只需要在显示调用函数函数库即可,在Makefile中GL_LIBS 后添加-lm

使用ld -v查看ld工具版本
从binutils2.22开始,ld开始把–no-copy-dt-needed-entries默认打开,这样一来,ld不会再自动递归地解析链接的lib,而需要由用户来一一指定。

<think>Hmm, the user is asking about a specific UnixBench error related to Perl library mismatches. Looking at the error message "Fcntl.c: loadable library and perl binaries are mismatched (got handshake key 0xf3000080, needed 0xf100080)", this seems to be a compatibility issue between Perl binaries and dynamically loaded libraries. The references provided in the context mention various compilation errors (like the 'sincos' linking issue in ubgears and nginx installation problems), but none directly address this particular Perl handshake key mismatch. However, the underlying theme is clear - these are all environment/version compatibility problems. I recall that this Perl error typically occurs when: - Perl has been upgraded without recompiling XS modules - Multiple Perl versions exist on the system - Architecture mismatches (like mixing 32-bit and 64-bit components) The user seems to be working with UnixBench in a Linux environment, likely compiling from source. They appear to have technical proficiency given they're dealing with compilation errors. Their core need is to resolve this blocking issue quickly. Considering solutions: First approach should be cleaning and rebuilding UnixBench completely as outdated object files often cause this. If that fails, checking Perl version consistency is crucial - especially because UnixBench includes Perl components. The handshake key values in the error (0xf3000080 vs 0xf100080) suggest major ABI incompatibility. The most comprehensive solution would involve reinstalling Perl modules properly with cpanm. The "--force" option may be necessary since this is a known environment mismatch case. For severe conflicts, a clean Perl environment via perlbrew might be needed, though that's more time-consuming. Should also mention preventive measures like avoiding partial Perl upgrades since that's probably what caused this. The user would appreciate understanding root cause to avoid recurrence. </think>根据您遇到的 UnixBench 错误 `Fcntl.c: loadable library and perl binaries are mismatched`,结合引用内容和解决方案,以下是完整解决步骤: ### 错误原因分析 该错误**本质是 Perl 二进制文件与动态加载库的版本不兼容**(如系统升级或模块未同步更新导致)。错误码 `0xf3000080 vs 0xf100080` 明确指示了二进制接口(ABI)不匹配[^1]。 --- ### 解决方案 #### 方法一:清理并重建 UnixBench(推荐优先尝试) ```bash # 进入 UnixBench 源码目录 cd UnixBench-5.1.3 # 彻底清理旧编译文件 make clean # 删除残留对象文件 find . -name "*.o" -delete # 重新编译安装 make ``` #### 方法二:修复 Perl 模块兼容性 ```bash # 重新安装 Perl 核心模块 sudo cpan -i -f Fcntl # 检查 Perl 版本一致性 perl -v && ldd /usr/bin/perl # 强制重建动态链接库缓存 sudo /sbin/ldconfig ``` #### 方法三:完整重装 Perl 环境(前两种无效时使用) ```bash # 安装 Perl 版本管理工具 sudo apt install perlbrew # 初始化环境 perlbrew init # 安装新 Perl 版本(示例) perlbrew install perl-5.34.0 # 切换至新版本 perlbrew switch perl-5.34.0 # 在新环境中重装 UnixBench make clean && make ``` --- ### 关键预防措施 1. **系统升级后**需执行 `sudo cpan -u` 更新所有 Perl 模块 2. 避免混合使用 `apt` 和 `cpan` 安装 Perl 模块 3. 运行 UnixBench 前检查依赖: ```bash # 检查缺失依赖 ./Run -v | grep "not found" ``` > **根本原因**:系统升级(如 Perl 或 libc)导致动态库 API 变更,而旧版 UnixBench 仍尝试加载不兼容的二进制接口(详见引用[^1]的链接器报错机制)。 ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值