error while loading shared libraries的解決方法
十几年前大佬的解决方案。。。管用。。。
在linux下运行程序时,发现了error while loading shared libraries这种错误,一时间不知道解决办法,在网上搜索,终于解决了:
./tests: error while loading shared libraries: xxx.so.0:cannot open shared object file: No such file or directory
出现这类错误表示,系统不知道xxx.so放在哪个目录下,这时候就要在/etc/ld.so.conf中加入xxx.so所在的目录。
一般而言,有很多的so会存放在/usr/local/lib这个目录底下,去这个目录底下找,果然发现自己所需要的.so文件。
所以,在/etc/ld.so.conf中加入/usr/local/lib这一行,保存之后,再运行:/sbin/ldconfig –v更新一下配置即可。

当在Linux环境中运行程序遇到'error while loading shared libraries'错误时,表明系统找不到所需的动态链接库文件。解决方法是将库文件所在的目录添加到/etc/ld.so.conf文件中,例如'/usr/local/lib',然后执行/sbin/ldconfig -v更新配置。此方案适用于找不到.so文件路径的情况。
3850

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



