转自: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. PHP iconv函数字符串转码导致截断问题

    1.iconv函数原型 string iconv ( string $in_charset , string $out_charset , string $str ) in_charset:输入的字符 ...

  2. WPF 组合快捷键

    if(e.KeyStates == Keyboard.GetKeyStates(Key.F4) && Keyboard.Modifiers == ModifierKeys.Alt) { ...

  3. C++中析构函数的作用,

    如果构造函数打开了一个文件,最后不需要使用时文件就要被关闭.析构函数允许类自动完成类似清理工作,不必调用其他成员函数.析构函数也是特殊的类成员函数.简单来说,析构函数与构造函数的作用正好相反,它用来完 ...

  4. word双面打印的方法

    首先要明白打印的过程 先进入打印机的纸张顶部,肯定是先打印,这样就确定了纸张放置的方向,不会放倒了 肯定是打印在纸张的向上的那一面,这样就确定了打印的正反面 纸张打印的顺序肯定是从上到下,这样就确定了 ...

  5. Object学习笔记

    <script type="text/javascript"> function forEach(o){ var html =""; for(var ...

  6. Help Me with the Game(imitate)

    Help Me with the Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3630   Accepted:  ...

  7. js实现文本框限制输入数字和小数点--兼容多个浏览器

    <html> <head> <meta http-equiv="content-Type" content="text/html;chars ...

  8. [Effective JavaScript 笔记]第53条:保持一致的约定

    对于api使用者来说,你所使用的命名和函数签名是最能产生普遍影响的决策.这些约定很重要具有巨大的影响力.它建立了基本的词汇和使用它们的应用程序的惯用法.库的使用者必须学会阅读和使用这些.一致的约定可以 ...

  9. Correlation Filter in Visual Tracking

    涉及两篇论文:Visual Object Tracking using Adaptive Correlation Filters 和Fast Visual Tracking via Dense Spa ...

  10. BZOJ 1002 [ FJOI 2007 ]

    -------------------------萌萌哒分割线------------------------- 题目很容易看懂,数据范围也不大.当然可以卡过暴力的人了. 在n=1时很明显是一种,如下 ...