ldconfig 的简单用法

ldconfig: configure dynamic linker run-time binds.

比如,我编译完 boost 后(boost 的有些库需要编译后生成动态或静态库使用,例如 Python,Regex 等,详见 Boost 说明文档),需要将编译库路径,比如 /usr/local/lib 加入运行时动态绑定的搜索路径,步骤如下:

 

方法一:

Ubuntu 下,在 /etc/ld.so.conf.d 目录下新建配置文件,比如 boost_lib.conf,编辑其内容为,

/usr/local/lib

然后运行,

$ sudo ldconfig

然后应用程序就能正确找到 boost 相关链接文件了。

 

方法二:

将下述语句加到 .bashrc,

export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

 

完。

 

posted @ 2018-05-02 16:27  Anonymous596  阅读(7070)  评论(0编辑  收藏  举报