cannot open shared object file: No such file or directory

Posted zhanggaofeng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cannot open shared object file: No such file or directory相关的知识,希望对你有一定的参考价值。

一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误,
比如:
error while loading shared libraries: libxxx.so: cannot open shared object file: No such file or directory


原因一般有两个,

一个是操作系统里确实没有包含该共享库(lib*.so.*文件)或者共享库版本不对, 遇到这种情况重新下载并安装上即可.
另外一个原因就是已经安装了该共享库, 但执行需要调用该共享库的程序的时候, 程序按照默认共享库路径找不到该共享库文件.

解决方案:

1.检查系统路径(/usr/lib64或者/lib64)下是否有该文件
2.通过ldd命令检查当前so文件依赖的动态库是否都能找到
3.如果共享库文件安装到了/usr/local/lib目录下, 那么需执行一下ldconfig命令


说明:ldconfig命令的用途, 主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下,
搜索出可共享的动态链接库(格式如lib*.so*), 进而创建出动态装入程序(ld.so)所需的连接和缓存文件.
缓存文件默认为/etc/ld.so.cache, 此文件保存已排好序的动态链接库名字列表.










以上是关于cannot open shared object file: No such file or directory的主要内容,如果未能解决你的问题,请参考以下文章

error while loading shared libraries: libreadline.so.5: cannot open shared object file:

ImportError: liblapack.so.3: cannot open shared object file问题

error while loading shared libraries: libssl.so.6: cannot open shared object file

运行 jcontrol 报 libXext.so.6: cannot open shared object file 错误

问题解决:libprotobuf.so.28: cannot open shared object file

问题解决:libprotobuf.so.28: cannot open shared object file