在编译程序报了如下错误:/usr/bin/ld: cannot find -lmtcr_ul: No such file or directory
他的命名规则时"l+nameOfTheLibrary",所以我缺少一个mtcr_ul相关的库
问题原因
根本原因:还是某一个lib库文件不存在,你可以通过ld查看他需要什么库文件:
/usr/bin/ld -lmtcr_ul --verbose
==================================================
ld: mode aarch64linux
attempt to open /usr/local/lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /usr/local/lib/aarch64-linux-gnu/libmtcr_ul.a failed
attempt to open /lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /lib/aarch64-linux-gnu/libmtcr_ul.a failed
attempt to open /usr/lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /usr/lib/aarch64-linux-gnu/libmtcr_ul.a failed
attempt to open /usr/local/lib/libmtcr_ul.so failed
attempt to open /usr/local/lib/libmtcr_ul.a failed
attempt to open /lib/libmtcr_ul.so failed
attempt to open /lib/libmtcr_ul.a failed
attempt to open /usr/lib/libmtcr_ul.so failed
attempt to open /usr/lib/libmtcr_ul.a failed
attempt to open /usr/aarch64-linux-gnu/lib/libmtcr_ul.so failed
attempt to open /usr/aarch64-linux-gnu/lib/libmtcr_ul.a failed
ld: cannot find -lmtcr_ul: No such file or directory
attempt to open /usr/local/lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /usr/local/lib/aarch64-linux-gnu/mtcr_ul.a failed
attempt to open /lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /lib/aarch64-linux-gnu/mtcr_ul.a failed
attempt to open /usr/lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /usr/lib/aarch64-linux-gnu/mtcr_ul.a failed
attempt to open /usr/local/lib/libmtcr_ul.so failed
attempt to open /usr/local/lib/mtcr_ul.a failed
attempt to open /lib/libmtcr_ul.so failed
attempt to open /lib/mtcr_ul.a failed
attempt to open /usr/lib/libmtcr_ul.so failed
attempt to open /usr/lib/mtcr_ul.a failed
attempt to open /usr/aarch64-linux-gnu/lib/libmtcr_ul.so failed
attempt to open /usr/aarch64-linux-gnu/lib/mtcr_ul.a failed
这些lib库文件只要有一个就行,或者你有其他版本的库 可以做一下软链接
解决办法
解1
解决办法的话,找一个有这个库文件的机器,拷贝一份文件过来:比如在另外一台机器上
==================================================
ld: mode aarch64linux
attempt to open /usr/local/lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /usr/local/lib/aarch64-linux-gnu/libmtcr_ul.a failed
attempt to open /lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /lib/aarch64-linux-gnu/libmtcr_ul.a failed
attempt to open /usr/lib/aarch64-linux-gnu/libmtcr_ul.so failed
attempt to open /usr/lib/aarch64-linux-gnu/libmtcr_ul.a failed
attempt to open /usr/local/lib/libmtcr_ul.so failed
attempt to open /usr/local/lib/libmtcr_ul.a failed
attempt to open /lib/libmtcr_ul.so failed
attempt to open /lib/libmtcr_ul.a succeeded
/lib/libmtcr_ul.a
把/lib/libmtcr_ul.a拷贝到缺失的这个文件夹下就行
解2
找到这个库文件所属于哪个软件包
dpkg -S /lib/libmtcr_ul.a
或者直接google,找到后,直接apt install就好
但是有很多都找不到[捂脸哭]
解3
如果本机有相关软件包的话,可以做一下软链接
综上 第一个种方法最靠谱,但是得找一台有该软件包的环境。。。。。。
参考:
https://stackoverflow.com/questions/16710047/usr-bin-ld-cannot-find-lnameofthelibrary