ldd 动态库的路径 linux

 The necessary shared libraries needed by the program are searched for in the following order

o Using the environment variable LD_LIBRARY_PATH (LD_AOUT_LIBRARY_PATH for a.out programs). Except if the executable is a setuid/setgid binary, in which case it is ignored.

o From the cache file /etc/ld.so.cache which contains a compiled list of candidate libraries previously found
in the augmented library path.

o In the default path /lib, and then /usr/lib.

在linux下编程,需要加入参数如-lACE -lpthread -lrt,如果这个时候报:

$/usr/sbin/ld:Can't find -lACE,这个时候你就可以查看这三个地方,解决方面如下:

1、可以将第三方库路径加入LD_LIBRARY_PATH

2、在/lib或者/usr/lib中建立连接: ln -s /usr/share/acedir/.lib/ace.so libace.so,一定要起名字为libACE.so;如果发现so文件名为libACE-6.0.5.so,那就先建一个链接 ln -s /usr/share/acedir/.lib/libACE-6.0.5.so libACE.so,然后cp libACE.so /usr/lib;

3、将文件目录写入ld.so.conf,echo "/usr/share/acedir/.lib/" >>ld.so.conf,但是要记得/usr/share/acedir/.lib/中有libACE.so这个文件或链接;

最后,启动程序后,会报错:can't open object file or the file is not exists;

别忘了最后一步:ldconfig

OK!!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值