error while loading shared libraries 转载

来源:互联网 发布:网络文学创作原理在线 编辑:程序博客网 时间:2024/06/06 01:47
 

执行程式时,如此遇到像下列这种错误:

./tests: error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory ./tests: error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory

那就表示系統不知道xxx.so 放在哪個目錄下。那就表示系统不知道xxx.so放在哪个目录下。

這個時候就要在/etc/ld.so.conf中加入xxx.so所在的目錄。这个时候就要在/etc/ld.so.conf中加入xxx.so所在的目录。

一般而言,有很多so檔會在/usr/local/lib這個目錄下,所以在/etc/ld.so.conf中加入/usr/local/lib這一行,可以解決此問題。一般而言,有很多so档会在/usr/local/lib这个目录下,所以在/etc/ld.so.conf中加入/usr/local/lib这一行,可以解决此问题。

將/etc/ld.so.conf存檔後,還要執行「/sbin/ldconfig –v」來更新一下才會生效。将/etc/ld.so.conf存档后,还要执行「/sbin/ldconfig –v」来更新一下才会生效。