解决:error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

清泛编译

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

错误原因是缺少依赖库,使用ldd命令查看依赖库,例如:

[root@info lib]# ldd /usr/local/apache2/bin/httpd

       libaprutil-0.so.0 => /usr/local/apache2/lib/libaprutil-0.so.0 (0x00242000)

       libexpat.so.0 => /usr/lib/libexpat.so.0 (0x00554000)

       libapr-0.so.0 => /usr/local/apache2/lib/libapr-0.so.0 (0x007e2000)

       librt.so.1 => /lib/tls/librt.so.1 (0x00cb6000)

       libm.so.6 => /lib/tls/libm.so.6 (0x00259000)

       libcrypt.so.1 => /lib/libcrypt.so.1 (0x07213000)

       libnsl.so.1 => /lib/libnsl.so.1 (0x07246000)

       libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00442000)

       libdl.so.2 => /lib/libdl.so.2 (0x0027e000)

       libc.so.6 => /lib/tls/libc.so.6 (0x00282000)

       /lib/ld-linux.so.2 (0x0010d000)

查找lib库文件的位置(可以使用命令 whereis xxx ),并把目录添加到/etc/ld.so.conf.d/libc.conf中,没有则新建这个文件。然后再运行ldconfig才可以生效


解决:用以下shell命令解决:(用root用户)

echo "/usr/local/lib" >> /etc/ld.so.conf.d/libc.conf
sudo ldconfig
注:有些Linux发行版本配置文件路径是/etc/ld.so.conf,替换即可。

libraries

分享到:
评论加载中,请稍后...
创APP如搭积木 - 创意无限,梦想即时!
回到顶部