在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

linux /usr/bin/ld: cannot find -lxxx的更多相关文章

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

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

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

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

  3. linux /usr/bin/ld cannot find 解决

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

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

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

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

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

  6. 【转】linux /usr/bin/ld cannot find 解决

    原文网址:http://blog.csdn.net/mzwang123/article/details/6702889 问题:在linux环境编译应用程式或lib的source code时常常会出现如 ...

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

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

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

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

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

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

随机推荐

  1. CSS3 旋转代码备忘

    .Aclose { -webkit-transition-property: all; -webkit-transition-duration: .3s; -moz-transition-proper ...

  2. apache配置域名指向

    <VirtualHost *:80>ServerAdmin webmaster@example.com ——管理员邮箱(可以随便写一个)DocumentRoot "/home/p ...

  3. 一个服务器上面配置多个IP ,实现指定IP的域名请求

    //配置多个IP命名using System.Net; //********************************************************************** ...

  4. 发送短信(string转换为JSON)

    using Newtonsoft.Json;using System;using System.Collections.Generic;using System.Linq;using System.T ...

  5. 自定义表并实现Identity登录(一)

    注意,Microsoft.AspNet.Identity.Core.1.0.0和Microsoft.AspNet.Identity.Core.2.2.1差别太大,需考虑实际项目中用的是哪种,本文是基于 ...

  6. Python类属性,实例属性

    1.Python类数据属性:定义在类里面但在函数外面的变量,它们都是静态的. #一段很简单的代码,但反应了很多 >>> class A(): a=1 #一个类里面有个属性a > ...

  7. 今年几个项目中用到的一个jqueryTab插件感觉挺好用的

    名字叫:wdscrolltab 开源中国项目地址: http://www.oschina.net/p/wdscrolltab

  8. 6.3Sum && 4Sum [ && K sum ] && 3Sum Closest

    3Sum Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find a ...

  9. shell 初学者 必读 ,强烈推荐新手读

    背景: 很多人从C/C++转化而来,看了学习文档之后,踩入了很多坑 1 对变量赋值 不要有空格 a=123 # 正确 a = 123 # 错误 2  if语句 [] 要留有空格,变量最好加" ...

  10. spring mvc定时任务的简单使用

    版权声明:本文为楼主原创文章,未经楼主允许不得转载,如要转载请注明来源. 说起定时任务,开发的小伙伴们肯定不陌生了.有些事总是需要计算机去完成的,而不是傻傻的靠我们自己去.可是好多人对定时器总感觉很陌 ...