红联Linux门户
Linux帮助

Linux动态库加载失败:/dom1: error libmemcached.so.11的解决

发布时间:2017-06-12 09:57:01来源:linux网站作者:李伟1012
程序运行时有以下错误:
./dom1: error while loading shared libraries: libmemcached.so.11: cannot open shared object file: No such file or directory
动态库加载失败。
 
1、首先应该使用命令查看所加载的库
ldd ./dom1
linux-vdso.so.1 =>  (0x00007ffdb4368000)
libmemcached.so.11 => not found
libc.so.6 => /lib64/libc.so.6 (0x00007f4174962000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4174d33000)
看看所加载的库。
 
2、使用命令查看加载库时所搜索的路径
LD_DEBUG=libs ./dom1 -v
46688:  find library=libmemcached.so.11 [0]; searching
46688:  search cache=/etc/ld.so.cache
46688:  search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64:/usr/lib64        (system search path)
46688:   trying file=/lib64/tls/x86_64/libmemcached.so.11
46688:   trying file=/lib64/tls/libmemcached.so.11
46688:   trying file=/lib64/x86_64/libmemcached.so.11
46688:   trying file=/lib64/libmemcached.so.11
46688:   trying file=/usr/lib64/tls/x86_64/libmemcached.so.11
46688:   trying file=/usr/lib64/tls/libmemcached.so.11
46688:   trying file=/usr/lib64/x86_64/libmemcached.so.11
46688:   trying file=/usr/lib64/libmemcached.so.11
46688: 
./dom1: error while loading shared libraries: libmemcached.so.11: cannot open shared object file: No such file or directory
可以看出大多在lib64中搜索,由于我没有lib64这个目录我的是lib目录所以就报加载出错。
 
解决方案:
1、修改搜索目录。
2、给你lib中的库生成一个lib64的软连接就可以解决。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31425.html