执行程式时,如此遇到像下列这种错误:
./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」来更新一下才会生效。
解决Linux系统找不到.so文件问题
当执行Linux脚本或程序时,遇到错误提示找不到.so文件时,可通过修改/etc/ld.so.conf配置文件并执行ldconfig命令来解决该问题。
9147

被折叠的 条评论
为什么被折叠?



