在ubuntu中扩展默认的lib搜索路径

P M*_*P M 16 linux shared-libraries ubuntu-11.04

如何在ubuntu中扩展默认的lib搜索路径(以一种持久的方式)?不,我希望出口LD_LIBRARY_PATH基于治标不治本,而一些方法来扩展默认的lib搜索路径?

在google-ing的时候,我浏览了一些信息,在ubuntu中,默认搜索路径位于/etc/ld.so.conf.d,但编辑libc.conf并没有扩展默认路径..所以我想我要么做错了,或者有些东西丢失了......

编辑过的libc.conf看起来像......

# libc default configuration
/usr/local/lib:/path_to_my_libraries/lib
Run Code Online (Sandbox Code Playgroud)

ist*_*spl 29

创建(作为root)/etc/ld.so.conf.d/包含新路径的新文件.例如:

sudo echo "/path-to-your-libs/" >> /etc/ld.so.conf.d/your.conf
Run Code Online (Sandbox Code Playgroud)

在那之后

sudo ldconfig
Run Code Online (Sandbox Code Playgroud)

无需更改libc.conf.