Linux 清除和重建 ldconfig 缓存?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21758828/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Purging and rebuilding ldconfig cache?
提问by eminemence
I am trying to purge the ldconfig cache of links to libraries to link against. I have a local folder where newly built libraries are placed. I want to update the ldconfig cache to point to these newly built libs.
我正在尝试清除指向要链接的库的链接的 ldconfig 缓存。我有一个本地文件夹,其中放置了新建的库。我想更新 ldconfig 缓存以指向这些新构建的库。
I have tried using the ldconfig -c command, giving it my own .conf file. I also tried replacing the /etc/ld.so.conf file to point to the new path of libs. But even after doing this, when I check the cache using the ldconfig -p command , it is still showing the old libs.
我试过使用 ldconfig -c 命令,给它我自己的 .conf 文件。我还尝试替换 /etc/ld.so.conf 文件以指向 libs 的新路径。但即使这样做之后,当我使用 ldconfig -p 命令检查缓存时,它仍然显示旧的库。
Hence how to purge and rebuild the ldconfig cache? Just to add : I am on Ubuntu 13.10.
因此如何清除和重建 ldconfig 缓存?补充一点:我在 Ubuntu 13.10 上。
回答by codenamezero
2 years late, but in case someone stumble upon this, as su
, run the following commands:
晚了 2 年,但万一有人偶然发现了这一点su
,请运行以下命令:
rm /etc/ld.so.cache
ldconfig
回答by Karthik M
Rebuild cache
重建缓存
Open the /etc/ld.so.conf
as sudo and add a new line with the library directory. In this case, we add /usr/local/lib
.
Rerun ldconfig to rebuild the cache:
打开/etc/ld.so.conf
as sudo 并在库目录中添加一个新行。在这种情况下,我们添加/usr/local/lib
. 重新运行 ldconfig 以重建缓存:
$ sudo ldconfig
This worked for me.
这对我有用。
回答by Alexmaister
I solved the problem by doing the following:
我通过执行以下操作解决了这个问题:
$ > /etc/ld.so.cache
$ > /etc/ld.so.cache
then:
然后:
$ ldconfig
$ ldconfig