LD_LIBRARY_PATH vs ld.so.conf

 

http://www.cnblogs.com/westfly/archive/2010/12/06/1897792.html

LD_LIBRARY_PATH vs ld.so.conf

在LD_LIBRARY_PATH和 ld.so.conf上遇到点困难,搜索到有用的结果如下。

http://ubuntuforums.org/showthread.php?t=324660
/etc/ld.so.conf and run ldconfig
setting LD_LIBRARY_PATH is only useful if you have different versions of a library installed on a system and would prefer to use one over the other, or the executable is compiled to look for libraries in a specific location and you want to change it.

ld.so's cache wasn't up to date when you added /usr/local/lib/libxine.so (you have to run `ldconfig` after adding libraries, it rebuilds the cache; programs would load a lot slower if the lib paths were manually searched each time a program was opened) so it really couldn't locate the library, even though it was there.

上面的英文的意思是是不推荐用LD_LIBRARY_PATH ,LD_LIBRARY_PATH 可以作为不同版本的选择项。

Linux 共享库: LD_LIBRARY_PATH 与ld.so.conf
Linux 通用的做法是将非标准路经加入 /etc/ld.so.conf,然后运行 ldconfig 生成 /etc/ld.so.cache。 ld.so 加载共享库的时候,会从 ld.so.cache 查找。传 统上, Linux 的先辈 Unix 还有一个环境变量 - LD_LIBRARY_PATH 来处理非标准路经的共享库。ld.so 加载共享库的时候,也会查找这个变量所设置的路经。
有不少声音主张要避免使用 LD_LIBRARY_PATH 变量,尤其是作为全局变量。这些声音是:
* LD_LIBRARY_PATH is not the answer - http://prefetch.net/articles/linkers.badldlibrary.html
* Why LD_LIBRARY_PATH is bad - http://xahlee.org/UnixResource_dir/_/ldpath.html
* LD_LIBRARY_PATH - just say no - http://blogs.sun.com/rie/date/20040710

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值