转自:http://blog.csdn.net/david_xtd/article/details/7625626

前提:ubuntu-debug机器上向SVN提交了pdu-IVT,想在别的普通机器上验证直接make能否成功,编译出的用户程序能否运行。

工作PC机上装有VMware,里面的ubuntu版本跟ubuntu-debug机器上相同,都是ubuntu 11.10版本。

VMware的家目录下有个目录pdu-IVT,是从SVN上更新出来之后,直接拷贝过来的。

在将ubuntu-debug机器上,make能成功,并且生成的二进制可执行程序pdu也能运行,并与switch成功建立连接;

但在工作PC机的VMware中,运行make时,提示错误:

  1. /usr/bin/ld: cannot find -lCiscoEnergyWiseSdk
  2. collect2: ld returned 1 exit status
  3. make: *** [pdu] Error 1

分析原因:ld提示找不到库文件,而库文件就在当前目录中。

链接器ld默认的目录是/lib和/usr/lib,如果放在其他路径也可以,需要让ld知道库文件在哪里。

方法1:

编辑/etc/ld.so.conf文件,在新的一行中加入库文件所在目录;

运行ldconfig,以更新/etc/ld.so.cache文件;

方法2:

在/etc/ld.so.conf.d/目录下新建任何以.conf为后缀的文件,在该文件中加入库文件所在的目录;

运行ldconfig,以更新/etc/ld.so.cache文件;

本人觉得第二种办法更为方便,对于原系统的改动最小。因为/etc/ld.so.conf文件的内容是include /etc/ld.so.conf.d/*.conf

所以,在/etc/ld.so.conf.d/目录下加入的任何以.conf为后缀的文件都能被识别到。

  1. 本人的作法:
  2. 1. 将所有的用户需要用到的库放到/usr/loca/lib;
  3. 2. 在/etc/ld.so.conf.d/目录下新建文件usr-libs.conf,内容是:/usr/local/lib
  4. 3. #sudo ldconfig

ld.so.cache的更新是递增式的,就像PATH系统环境变量一样,不是从头重新建立,而是向上累加。

除非重新开机,才是从零开始建立ld.so.cache文件。

错误解决error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file的更多相关文章

  1. error while loading shared libraries: libXXX.so.x: cannot open shared object file: No such file or directory .

    转载:http://www.eefocus.com/pengwr/blog/2012-02/235057_baf52.html 此时你可以locate libXXX.so.x 一下,查看系统里是否有该 ...

  2. 解决error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file

    原文地址:http://blog.csdn.net/yjk13703623757/article/details/53217377 一.问题 运行hydra时,提示错误: hydra : error ...

  3. 错误解决:error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory

    执行以下代码,生成唯一的UID $fp = popen("/xxx/bin/tools/uuidgen system", "r");// $uid = frea ...

  4. 解决软件启动报error while loading shared libraries: libgd.so.2: cannot open shared object错误

    解决软件启动报error while loading shared libraries: libgd.so.2: cannot open shared object错误 今天安装启动nginx的时候报 ...

  5. Ubuntu12.04安装64位系统出现编译错误error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or dir

    问题: Ubuntu12.04安装64位系统出现编译错误error while loading shared libraries: libz.so.1: cannot open shared obje ...

  6. Atlas系列一:【已解决】error while loading shared libraries: libcrypto.so.6: cannot open shared object file: No such file or directory

    1:Atlas的安装 https://github.com/Qihoo360/Atlas/wiki/Atlas的安装 2: [root@localhost bin]# ./mysql-proxyd t ...

  7. MYSQL之 error while loading shared libraries: libtinfo.so.5: cannot open shared objectfile: No such f

    环境:ubuntu18 登陆MYSQL时遇到错误:mysql: error while loading shared libraries: libtinfo.so.5: cannot open sha ...

  8. 报错libtest: error while loading shared libraries: libuv.so.1: cannot open shared object file: No such file or directory

    使用g++编译.运行libuv的demo错误解决 我们通过例子来讲述监视器的使用. 例子中空转监视器回调函数被不断地重复调用,  通过例子我们也可以了解到: 由于设置了监视器, 所以调用 uv_run ...

  9. error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

    编译出现如下错误: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such ...

随机推荐

  1. pthread_cancel

    #include <pthread.h> #include <stdio.h> #include<stdlib.h> #include <unistd.h&g ...

  2. 9个 SSH常用命令选项

    9个 SSH常用命令选项 SSH 是什么 SSH(全称 Secure Shell)是一种加密的网络协议.使用该协议的数据将被加密,如果在传输中间数据泄漏,也可以确保没有人能读取出有用信息.要使用 SS ...

  3. Android EditText的设置

    1.输入法Enter键图标的设置: 软件盘的界面替换只有一个属性android:imeOptions,这个属性的可以取的值有normal,actionUnspecified,actionNone,ac ...

  4. gem install factory_girl

    文章是从个人博客转过来的,  可以直接访问 iwangzheng.com https://github.com/thoughtbot/factory_girl https://github.com/t ...

  5. HDOJ 1102 生成树

    Constructing Roads Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Other ...

  6. MongoDB概述&语法

    Nosql DB 这是一个非关系型数据库. 通常我们的数据库有三类:  关系型数据库(RDBMS),联机分析处理数据库(OLAP),和菲关系型数据库(NoSql). MongoDB属于第三种,而且是一 ...

  7. 【Python】django多对多 查询 ,反查等操作

    The Django Book中这样写 但我使用属性名后加_set会报错 而直接用members = group.user_group_join.all() 就可以 可能因为我的MyUser类里有两个 ...

  8. 《ASP.NET MVC4 WEB编程》学习笔记------Web API

    本文截取自情缘 1. Web API简单说明 近来很多大型的平台都公开了Web API.比如百度地图 Web API,做过地图相关的人都熟悉.公开服务这种方式可以使它易于与各种各样的设备和客户端平台集 ...

  9. Ninject学习笔记<二>

    本文转载自kuangkro 如果给您带来不便请联系博主 一.控制反转和依赖注入 Ninject是一个轻量级的基于.Net平台的依赖注入(IOC)框架.所谓的IOC,即控制反转(Inversion of ...

  10. python - easy_install的安装和使用

    为什么要装easy_install?正常情况下,我们要给Python安装第三方的扩展包,我们必须下载压缩包,解压缩到一个目录,然后命令行或者终端打开这个目录,然后执行python setup.py i ...