解决 error while loading shared libraries 错误方法
2014-04-09 11:03
886 查看
这是由于某些外部程序找不到共享库。所以得指明这个共享库的位置
有权限的话推荐下面的方法:
在这个文件里加入:
然后再执行
因为为了加快程序执行时对共享库的定位速度,避免使用搜索路径查找共享库的低效率,所以是直接读取库列表文件 /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 文件之后才可以。ldconfig ,简单的说,它的作用就是将/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.so.cache 以供使用。因此当安装完一些库文件,(例如刚安装好glib),或者修改ld.so.conf增加新的库路径后,需要运行一下 /sbin/ldconfig使所有的库文件都被缓存到ld.so.cache中,如果没做,即使库文件明明就在/usr/lib下的,也是不会被使用的
还有一种临时的方法,一般没有权限的时候使用
可以export一个全局变量
顺便说一句,如果目前的库是高版本的,xxx.so.5 但是程序报错是xxx.so.4 找不到,可以做一个软链接,因为一般都是可以向下兼容的
有权限的话推荐下面的方法:
vi /etc/ld.so.conf
在这个文件里加入:
/usr/local/lib来指明共享库的搜索位置
然后再执行
/sbin/ldconf
因为为了加快程序执行时对共享库的定位速度,避免使用搜索路径查找共享库的低效率,所以是直接读取库列表文件 /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 文件之后才可以。ldconfig ,简单的说,它的作用就是将/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.so.cache 以供使用。因此当安装完一些库文件,(例如刚安装好glib),或者修改ld.so.conf增加新的库路径后,需要运行一下 /sbin/ldconfig使所有的库文件都被缓存到ld.so.cache中,如果没做,即使库文件明明就在/usr/lib下的,也是不会被使用的
还有一种临时的方法,一般没有权限的时候使用
可以export一个全局变量
LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
顺便说一句,如果目前的库是高版本的,xxx.so.5 但是程序报错是xxx.so.4 找不到,可以做一个软链接,因为一般都是可以向下兼容的
ln -s /usr/local/lib/xxx.so.5 /usr/local/lib/xxx.so.4
相关文章推荐
- error while loading shared libraries:错误的原因和解决方法
- Linux下报“error while loading shared libraries: libncurses.so.4...”错误的解决方法
- CentOS7-error while loading shared libraries: 错误解决方法总结
- error while loading shared libraries: xxx.so.x" 错误的原因和解决办法
- httrack: error while loading shared libraries: libhttrack.so.2的解决方法
- error while loading shared libraries: xxx.so.x"错误的原因和解决办法
- "error while loading shared libraries: xxx.so.x" 错误的原因和解决办法
- error while loading shared libraries: libssl.so.4问题解决方法
- error while loading shared libraries: xxx.so.x"错误的原因和解决办法
- "error while loading shared libraries: xxx.so.x" 错误原因和解决办法
- error while loading shared libraries: xxx.so.x"错误的原因和解决办法
- error while loading shared libraries的解决方法2则
- error while loading shared libraries: xxx.so.x" 错误的原因和解决办法
- error while loading shared libraries: xxx.so.x"错误的原因和解决办法
- 解决error while loading shared libraries: libmysqlclient.so.15: cannot restore segment prot after reloc: Permission denied的错误
- error while loading shared libraries: xxx.so.x" 错误的原因和解决办法
- error while loading shared libraries: xxx.so.x"错误的原因和解决办法
- error while loading shared libraries: libpcap.so.1 解决方法
- error while loading shared libraries: xxx.so.x"错误的原因和解决办法
- "error while loading shared libraries: xxx.so.x" 错误的原因和解决办法