库文件在连接(静态库和共享库)和运行(仅限于使用共享库的程序)时被使用,其搜索路径是在系统中进行设置的 。一般 Linux 系统把 /lib 和 /usr/lib 两个目录作为默认的库搜索路径,所以使用这两个目录中的库时不需要进行设置搜索路径即可直接使用。
对于处于默认库搜索路径之外的库,需要将库的位置添加到库的搜索路径之中。设置库文件的搜索路径有下列两种方式,可任选其一使用。
- 在环境变量 LD_LIBRARY_PATH
中指明库的搜索路径
- 在 /etc/ld.so.conf
文件中添加库的搜索路径,将自己可能存放库文件的路径都加入到/etc/ld.so.conf
中,然后执行/sbin/ldconfig
命令。
注意:第二种搜索路径的设置方式对于程序连接时的库(包括共享库和静态库)的定位已经足够了,但是对于使用了共享库的程序的执行还是不够的。因为为了加快程序执行时对共享库的定位速度,避免使用搜索路径查找共享库的低效率,所以是直接读取库列表文件 /etc/ld.so.cache 从中进行搜索的。/etc/ld.so.cache 是一个非文本的数据文件,不能直接编辑,它是根据 /etc/ld.so.conf 中设置的搜索路径由 /sbin/ldconfig 命令将这些搜索路径下的共享库文件集中在一起而生成的(ldconfig 命令要以 root 权限执行)。因此,为了保证程序执行时对库的定位,在 /etc/ld.so.conf 中进行了库搜索路径的设置之后,还必须要运行 /sbin/ldconfig 命令更新 /etc/ld.so.cache 文件之后才可以。
分享到:
相关推荐
linux运行zipalign报错“error while loading shared libraries: libc++.so“ 相关文章链接https://blog.csdn.net/u010775335/article/details/124869330
tmux: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory 原因一般有两个, 一个是操作系统里确实没有包含该共享库(lib*.so.*文件)或者共享库...
本文提供了解启动MongoDB时提示:error while loading shared libraries: libstdc++.so.6: cannot open shared object file: 错误的解决方案
主要介绍了安装ImageMagick出现error while loading shared libraries的解决方法,是ImageMagick安装与运行中经常出现的问题,需要的朋友可以参考下
MYSQL之 error while loading shared libraries: libtinfo.so.5: cannot open shared objectfile: No such f-附件资源
libssl.so.10缺失库文件的解决办法,error while loading shared libraries :libssl.so.10:cannot open shared object file:No such file or directory
deepstream-app: error while loading shared libraries: libnvinfer.so.7: cannot open shared object file: No such file or directory
报错内容:sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory 启动时如果报异常error while loading shared libraries: libpcre.so....
bedGraphToBigWig: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory 就将使用root用户,将这两个文件放到/usr/lib64/ 或则使用: ln -s /usr/...
errorloadingos解决方法[文].pdf
该文件可以用于解决启动verdi后的报错,verdi/platform/LINUXAMD64/bin/ Novas: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory 注意适用于64...
NULL 博文链接:https://java-doom.iteye.com/blog/1821918
从 ubuntu16.04 里复制出来的 libpng12.so.0 是64位系统库,使用时需要复制到路径 /usr/lib/x86_64-linux-gnu
bin/postconf: error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directoryPlease specify the final destination directory for installed Postfix ...
libXp.so.6: cannot open shared object file: No such file or directory [oracle@dbadb1 ~]$ ls -ld /usr/lib/libXp.so.6 ls: /usr/lib/libXp.so.6: No such file or directory [root@dbadb1 zhuxu]# rpm -ivh...
在红帽下虚拟powerPC970 安装AIX 虚拟powerPC的安装包 参考http://hi.baidu.com/p2p%C6%F0%B7%C9的安装手册