Linux 下 cannot open shared object file 报错问题
一、问题描述$ ./client -p7300 -i127.0.0.1 -t10 -n1./client: error while loading shared libraries: libsqlite3.so.0: cannot open shared object file: No such file or directory1.问题分析这里 libsqlite3.so.0 是sqllite在
·
一、问题描述
$ ./client -p7300 -i127.0.0.1 -t10 -n1
./client: error while loading shared libraries: libsqlite3.so.0: cannot open shared object file: No such file or directory
1.问题分析
这里 libsqlite3.so.0 是sqllite在Linux 下的动态库,在编译时进行了链接,但系统仍无法找到并成功打开。
$ make
gcc -I/home//temperature/client/src/../inc/ *.c -oclient -lsqlite3 -L/home/zhangxiangyun/build/sqlite/install/lib
2.原因分析
cannot open shared object file 有两个原因:
1.一个是确实没有该文件,即没有安装该共享库;
2.另一个是已经安装了该共享库,但是执行需要调用该共享库程序的时候,程序按照默认共享库路径找不到该共享库文件。
所以如果安装共享库了,那么就需要正确设置共享库路径。
二、问题解决
1.将所需要的libmycrypto.so文件拷贝到/usr/lib路径下,当然这需要root权限;
2.使用export命令在LD_LIBRARY_PATH环境变量中添加该动态库所在的路径,注意该命令只是临时生效,重启后失效。另外指定的路径必须是绝对路径。
export LD_LIBRARY_PATH=/home/build/sqlite/install/lib
$ ./client -p7300 -i127.0.0.1 -t10 -n1
client : 16:59:23 [INFO ]
-----------CLIENT START!------------
这样可以看到程序可以成功运行。但该办法仅在该进程中有效。
优化办法:可将该命令添加到./bushrc中,每次重启后系统自动运行。
3. 使用shell
更多推荐
所有评论(0)