You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 23.04编译gpx2video时C编译器链接失败,提示库不兼容或找不到

Ubuntu 23.04编译gpx2video时C编译器链接失败,提示库不兼容或找不到

嘿,我看了你的编译错误日志,问题根源很明确:你系统里正在使用的ld链接器版本太旧,和Ubuntu 23.04自带的glibc库不兼容。

从日志里的关键错误能看出来:

  • /usr/local/bin/ld提示不支持.relr.dyn段(这是glibc 2.34+引入的新段格式)
  • 它跳过了系统自带的/lib/x86_64-linux-gnu/libc.so.6和/lib64/ld-linux-x86-64.so.2,最后直接找不到这些库

这大概率是因为你之前手动安装了旧版本的binutils(ld是binutils的一部分),它覆盖了Ubuntu系统默认的链接器。给你几个解决步骤:

1. 确认当前使用的ld路径

先跑这个命令看看你现在用的是哪个ld:

which ld

如果输出是/usr/local/bin/ld,那确实是手动安装的版本搞的鬼。

2. 恢复系统默认的链接器

  • 先备份旧的ld,避免删错:
    sudo mv /usr/local/bin/ld /usr/local/bin/ld.old
    
  • 之后系统会自动使用默认的/usr/bin/ld,如果还是有问题,可以手动创建软链:
    sudo ln -s /usr/bin/ld /usr/local/bin/ld
    

3. 重新编译gpx2video

先清空之前的build目录,避免残留的缓存影响:

cd /media/DATA_G_Ext4/Gopro/gpx2video/gpx2video
rm -rf build && mkdir build && cd build
cmake ..
make

附上你提供的完整错误日志:

CMake Error at /usr/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):

The C compiler

"/usr/bin/cc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /media/DATA_G_Ext4/Gopro/gpx2video/gpx2video/build/CMakeFiles/CMakeScratch/TryCompile-lKh0gb

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_f5b91/fast && /usr/bin/gmake -f CMakeFiles/cmTC_f5b91.dir/build.make CMakeFiles/cmTC_f5b91.dir/build

gmake[1]: entry into directory «/media/DATI_G_Ext4/Gopro/gpx2video/gpx2video/build/CMakeFiles/CMakeScratch/TryCompile-lKh0gb»

Building C object CMakeFiles/cmTC_f5b91.dir/testCCompiler.c.o

/usr/bin/cc -o CMakeFiles/cmTC_f5b91.dir/testCCompiler.c.o -c /media/DATA_G_Ext4/Gopro/gpx2video/gpx2video/build/CMakeFiles/CMakeScratch/TryCompile-lKh0gb/testCCompiler.c

Linking C executable cmTC_f5b91

/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f5b91.dir/link.txt --verbose=1

/usr/bin/cc -rdynamic CMakeFiles/cmTC_f5b91.dir/testCCompiler.c.o -o cmTC_f5b91

/usr/local/bin/ld: warning: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002

/usr/local/bin/ld: warning: /lib/x86_64-linux-gnu/libc.so.6: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0008002

/usr/local/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: unknown type [0x13] section `.relr.dyn'

/usr/local/bin/ld: skipped incompatible /lib/x86_64-linux-gnu/libc.so.6 when searching for /lib/x86_64-linux-gnu/libc.so.6

/usr/local/bin/ld: cannot find /lib/x86_64-linux-gnu/libc.so.6

/usr/local/bin/ld: /lib64/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'

/usr/local/bin/ld: skipped incompatible /lib64/ld-linux-x86-64.so.2 when searching for /lib64/ld-linux-x86-64.so.2

/usr/local/bin/ld: cannot find /lib64/ld-linux-x86-64.so.2

collect2: error: ld returned 1 exit status

gmake[1]: *** [CMakeFiles/cmTC_f5b91.dir/build.make:99: cmTC_f5b91] Error 1

gmake[1]: output from directory «/media/DATA_G_Ext4/Gopro/gpx2video/gpx2video/build/CMakeFiles/CMakeScratch/TryCompile-lKh0gb»

gmake: *** [Makefile:127: cmTC_f5b91/fast] Error 2

备注:内容来源于stack exchange,提问作者vimo58

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 12:24:36