例: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

例:

error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

(1)、

在linux下运行程序时,发现error while loading shared libraries 这种错误:

./a.out: error while loading shared libraries: xxx.so:cannot open shared object file: No such file or directory

出现这类错误表示:

 系统不知道xxx.so放在哪个目录下,这时候就要在/etc/ld.so.conf中加入xxx.so所在的目录。

 比如一般而言,有很多的so会存放在/usr/local/lib这个目录底下,在/etc/ld.so.conf中加入/usr/local/lib这一行,保存之后,再运行:/sbin/ldconfig -v 更新一下配置即可。

(2)、

进入/usr/local/mysql/lib/ 目录查看,确认有libmysqlclient.so.20 文件, 于是需要在/usr/lib目录下建立一个软链接来指向libmysqlclient.so.20
在/usr/lib/下建立个软链接:

 ln -s /usr/local/mysql/lib/libmysqlclient.so.20  /usr/lib/


(1)、

在linux下运行程序时,发现error while loading shared libraries 这种错误:

./a.out: error while loading shared libraries: xxx.so:cannot open shared object file: No such file or directory

出现这类错误表示:

 系统不知道xxx.so放在哪个目录下,这时候就要在/etc/ld.so.conf中加入xxx.so所在的目录。

 比如一般而言,有很多的so会存放在/usr/local/lib这个目录底下,在/etc/ld.so.conf中加入/usr/local/lib这一行,保存之后,再运行:/sbin/ldconfig -v 更新一下配置即可。

(2)、

进入/usr/local/mysql/lib/ 目录查看,确认有libmysqlclient.so.20 文件, 于是需要在/usr/lib目录下建立一个软链接来指向libmysqlclient.so.20
在/usr/lib/下建立个软链接:

 ln -s /usr/local/mysql/lib/libmysqlclient.so.20  /usr/lib/


猜你喜欢

转载自blog.csdn.net/w77_20/article/details/79268427