error while loading shared libraries: libXX-2.0.so.5: cannot open shared object file: No such file
来源:互联网 发布:pymongo 读取数据 编辑:程序博客网 时间:2024/05/21 10:20
问题
运行时出现如下问题
$ ./orangeapp./orangeapp: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
从错误提示看,是没有找到event库。
编译时的编译选项“-l event -L/usr/local/lib/”,用于指定了库名称和路径,这个只是编译链接时使用。而运行时,event库所在目录/usr/local/lib不在系统搜索范围内,所以无法找到。
解决办法
(1)临时export:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
(2)永久起效:
~/.bashrc 中,在该文件的未尾,添加语句:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
保存文件,最后执行source语句使之生效。
$ source ~/.bashrc
(3)编译时指定:
编译时指定程序执行时库的搜索路径,使用”-Wl, rpath”选项,如下所示:
$ gcc -Wl,-rpath,/usr/local/lib test.c
0 0
- error while loading shared libraries: libXX-2.0.so.5: cannot open shared object file: No such file
- error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file
- error while loading shared libraries: libXXX.so.x: cannot open shared object file: No such file
- error while loading shared libraries: libssl.so.4: cannot open shared object file: No such file.....
- error while loading shared libraries: libiw.so.29: cannot open shared object file: No such file
- error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file
- error while loading shared libraries: XXX.so: cannot open shared object file: No such file...
- jps: error while loading shared libraries: libjli.so: cannot open shared object file: No such file..
- error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file
- error while loading shared libraries: libcudart.so.6.5: cannot open shared object file: No such file
- Error: while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file
- error while loading shared libraries: libXXX.so.X: cannot open shared object file: No such file
- error while loading shared libraries: libcudart.so.8.0: cannot open shared object file: No such file
- error while loading shared libraries: libcudart.so.7.5: cannot open shared object file: No such file
- error while loading shared libraries: libmkl_rt.so: cannot open shared object file: No such file or
- aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file
- error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file
- error while loading shared libraries: ***.so: cannot open shared object file: No such file or direct
- appium与自动化测试(一)
- Linux配置Java环境变量
- 线程控制—sleep()
- java web项目中使用log4j
- 基于矩阵实现的Connected Components算法
- error while loading shared libraries: libXX-2.0.so.5: cannot open shared object file: No such file
- CCCC-GPLT L1-037. A除以B 团体程序设计天梯赛
- hdu4294-网络流+最短路
- 4种类型转换操作符 (static_cast const_cast dynamic_cast reinterpret_cast)
- tensorflow-示例2(MNIST集合上进行分类深度卷积网DCNN)
- Leetcode题目按Tag分类
- [BZOJ3963][WF2011]MachineWorks(斜率优化dp+cdq分治)
- 记一次读书感想
- 机房重构Bug