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 相关链接文件了。

完。

猜你喜欢

转载自www.cnblogs.com/gaowengang/p/8980956.html