在linux环境编译应用程式或lib的source code时常常会出现如下的错误讯息:

  • /usr/bin/ld: cannot find -lxxx

这些讯息会随着编译不同类型的source code 而有不同的结果出来如:

  • /usr/bin/ld: cannot find -lc
  • /usr/bin/ld: cannot find -lltdl
  • /usr/bin/ld: cannot find -lXtst

其中xxx即表示函式库文件名称,如上例的:libc.so、libltdl.so、libXtst.so。
其命名规则是:lib+库名(即xxx)+.so。

会发生这样的原因有以下三种情形:

1 系统没有安装相对应的lib
2 相对应的lib版本不对
3 lib(.so档)的symbolic link 不正确,没有连结到正确的函式库文件(.so)

解决方法:
(1)先判断在/usr/lib 下的相对应的函式库文件(.so) 的symbolic link 是否正确
若不正确改成正确的连结目标即可解决问题。

(2)若不是symbolic link 的问题引起,而是系统缺少相对应的lib安装lib即可解决。

(3)如何安装缺少的lib:
以上面三个错误讯息为例:

错误1缺少libc的LIB
错误2缺少libltdl的LIB
错误3缺少libXtst的LIB

 

  以Ubuntu为例:
  先搜寻相对应的LIB再进行安装的作业如:

  apt-cache search libc-dev
apt-cache search libltdl-dev
apt-cache search libXtst-dev

实例:
在进行输入法gcin的Source Code的编译时出现以下的错误讯息:

/usr/bin/ld: cannot find -lXtst

经检查后发现是:
lib(.so档)的symbolic link 不正确

解决方法如下:

cd /usr/lib
ln -s libXtst.so.6 libXtst.so

如果在/usr/lib的目录下找不到libXtst.so 档,那么就表示系统没有安装libXtst的函式库。
解法如下:

apt-get install libxtst-dev

转自:http://blog.sina.com.cn/s/blog_616fb0880100xrjj.html

[转载]解决/usr/bin/ld: cannot find -lxxx的更多相关文章

  1. ubuntu中解决/usr/bin/ld: cannot find -lxxx

    解决/usr/bin/ld: cannot find -lxxx 在linux环境编译应用程式或lib的source code时常常会出现如下的错误讯息:/usr/bin/ld: cannot fin ...

  2. (转载)关于usr/bin/ld: cannot find -lxxx问题总结

    usr/bin/ld: cannot find -lxxx问题总结 linux下编译应用程序常常会出现如下错误:   /usr/bin/ld: cannot find -lxxx        意思是 ...

  3. 关于usr/bin/ld: cannot find -lxxx问题总结

    /usr/bin/ld: cannot find -lxxx问题总结   linux下编译应用程序常常会出现如下错误:     /usr/bin/ld: cannot find -lxxx       ...

  4. 【转】关于usr/bin/ld: cannot find -lxxx问题总结

    原文网址:http://eminzhang.blog.51cto.com/5292425/1285705 /usr/bin/ld: cannot find -lxxx问题总结   linux下编译应用 ...

  5. /usr/bin/ld: cannot find -lxxx 的解决办法

    /usr/bin/ld: cannot find -lxxx 的解决办法 在软件编译过程中,经常会碰到类似这样的编译错误: /usr/bin/ld: cannot find -lhdf5 这表示找不到 ...

  6. Linux系统中提示/usr/bin/ld: cannot find -lxxx错误的通用解决方法

    在linux环境编译应用程式或lib的source code时常常会出现如下的错误讯息: 代码如下: /usr/bin/ld: cannot find -lxxx 这些讯息会随着编译不同类型的sour ...

  7. 【转】链接任意目录下库文件(解决错误“/usr/bin/ld: cannot find -lxxx”

    netbeans构建项目也出现了同样的问题.猜测是netbeans内部就用的是-l 这种编译方式,所以需要把***.a手动改为lib***.a 原文地址:链接任意目录下库文件(解决错误“/usr/bi ...

  8. Linux下库文件的设置 (/usr/bin/ld: cannot find -lxxx 的解决办法)

    在软件编译过程中,经常会碰到类似这样的编译错误: /usr/bin/ld: cannot find -lhdf5 这表示找不到库文件 libhdf5.so,若是其它库文件,则是 cannot find ...

  9. 系统中提示未找到/usr/bin/ld: cannot find -lxxx错误的通用解决方法

    在linux环境编译应用程式或lib的source code时常常会出现如下的错误讯息: 代码如下: /usr/bin/ld: cannot find -lxxx 这些讯息会随着编译不同类型的sour ...

随机推荐

  1. Mysql查询缓存研究

    转载声明:本文为DBA+社群原创文章,转载必须连同本订阅号二维码全文转载,并注明作者名字及来源:DBA+社群(dbaplus). http://mp.weixin.qq.com/s?__biz=MzI ...

  2. HDU 5186

    easy !! #include <iostream> #include <cstdio> #include <algorithm> #define LL __in ...

  3. SE955 激光扫描头设置 通过SSI串口进行设置

    扫描头是能够进行配置的,使其支持与禁用某些条码类型,设置有两种方式,一种是扫一下相应的设置条码,还有一种是通过SSI(simple serial interface)来设置,以下就讲一下SSI的设置方 ...

  4. Linux Terminal fortune

    Linux下,我们能够使用apt-get安装fortune,这是一个比較有趣的功能 在输入fortune之后,Terminal会输出一句名言.诗句,或一些有趣的话: 默认情况下.fortune仅仅会显 ...

  5. Mysql db

    hibernate中dialect的讲解 RDBMS方言 DB2 org.hibernate.dialect.DB2Dialect DB2 AS/400 org.hibernate.dialect.D ...

  6. luogu1226 取余运算||快速幂

    题目大意:快速求$a^b\mod p$的值. 根据二进制,令$b=\sum t_k\cdot 2^k, t\in \{0,1\}$,那么$$a^b=a^{\sum t_k\cdot 2^k}\mod ...

  7. 国外物联网平台初探(六) ——Electric Imp

    公司背景 Electric Imp成立于2011年,公司设立在美国加利福尼亚州洛斯阿尔托斯和英国剑桥 公司投资者包括:富士康技术集团.PTI创投.Rampart资本.Redpoint创投 定位 Ele ...

  8. DNS同时占用UDP和TCP端口53——传输数据超过512时候用tcp,DNS服务器可以配置仅支持UDP查询包

    DNS同时占用UDP和TCP端口53是公认的,这种单个应用协议同时使用两种传输协议的情况在TCP/IP栈也算是个另类.但很少有人知道DNS分别在什么情况下使用这两种协议. 先简单介绍下TCP与UDP. ...

  9. [POJ 3345] Bribing FIPA

    [题目链接] http://poj.org/problem?id=3345 [算法] 树形背包 [代码] #include <algorithm> #include <bitset& ...

  10. B - Soldier and Bananas

    Problem description A soldier wants to buy w bananas in the shop. He has to pay k dollars for the fi ...