/usr/bin/ld:构建调试/obj/gpsitem.o:文件无法识别:文件被截断

Posted

技术标签:

【中文标题】/usr/bin/ld:构建调试/obj/gpsitem.o:文件无法识别:文件被截断【英文标题】:/usr/bin/ld: build-debug/obj/gpsitem.o: file not recognized: file truncated 【发布时间】:2019-10-19 16:26:52 【问题描述】:

我正在使用 QT 构建/运行,但出现错误:

/usr/bin/ld: build-debug/obj/gpsitem.o: file not recognized: file truncated

/usr/bin/ld: build-debug/obj/gpsitem.o: file not recognized: file truncated
collect2: error: ld returned 1 exit status
make: *** [Makefile:1703: debug/apmplanner2] Error 1
21:34:14: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project apm_planner (kit: Desktop)
When executing step "Make"
21:34:16: Elapsed time: 1:48:02.

有人知道为什么会这样吗?

QT Creator 4.8.2
Based on QT 5.11.3 (GCC 8.3.0, 32 bit)
amhf raspberry pi

更新: 清理构建目录,新错误

/usr/local/Qt-5.11.3/bin/uic: error while loading shared libraries: libicui18n.so.57: cannot open shared object file: No such file or directory
/usr/local/Qt-5.11.3/bin/uic: error while loading shared libraries: libicui18n.so.57: cannot open shared object file: No such file or directory
/usr/local/Qt-5.11.3/bin/uic: error while loading shared libraries: libicui18n.so.57: cannot open shared object file: No such file or directory
make: *** [Makefile:70925: build-debug/ui/ui_mapripform.h] Error 127
make: *** Waiting for unfinished jobs....
make: *** [Makefile:70929: build-debug/ui/ui_MainWindow.h] Error 127
make: *** [Makefile:70933: build-debug/ui/ui_CommSettings.h] Error 127
/usr/local/Qt-5.11.3/bin/uic: error while loading shared libraries: libicui18n.so.57: cannot open shared object file: No such file or directory
make: *** [Makefile:70937: build-debug/ui/ui_SerialSettings.h] Error 127
18:04:19: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project apm_planner (kit: Desktop)
When executing step "Make"
18:04:19: Elapsed time: 00:04.

如何获取libicui18n.so.57?

【问题讨论】:

文件可能损坏? 可能是构建失败(编译器崩溃或有人在中途停止构建)导致文件损坏。尝试擦除您的构建目录并从头开始一个干净的构建。 清理构建目录,错误更改为/usr/local/Qt-5.11.3/bin/uic:加载共享库时出错:libicui18n.so.57:无法打开共享对象文件:没有这样文件或目录 安装 libicui 解决了这个问题 【参考方案1】:

安装 libicui57 解决了这个问题

【讨论】:

以上是关于/usr/bin/ld:构建调试/obj/gpsitem.o:文件无法识别:文件被截断的主要内容,如果未能解决你的问题,请参考以下文章

/usr/bin/ld: 在 Linux Mint 上的 Qt Creator 中构建 Qt5 应用程序时找不到 lGL

/usr/bin/ld: 找不到 -lfreetype qt

/usr/bin/ld: 搜索 -lQtCore 时跳过不兼容的 /usr/lib/x86_64-linux-gnu/libQtCore.so

/usr/bin/ld: 找不到 -ldlib /usr/bin/ld: 找不到 -lcblas /usr/bin/ld: 找不到 -llapack

/usr/bin/ld: cannot find -llzma /usr/bin/ld: cannot find -lbz2

/usr/bin/ld: 找不到 -ll