1. 出现以下错误的时候,error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory 代表某些包,软件是没有办法引用依赖包
因此 : 我们可以通过以下方法进行查找缺少的包的查找路径
LD_DEBUG=libs /usr/local/bin/fdfs_test -v 2>&1 > /dev/null | less
因为我们看见 查找顺序如下:
17166: find library=libevent-1.4.so.2 [0]; searching
17166: search cache=/etc/ld.so.cache
17166: search path=/lib/tls/x86_64:/lib/tls:/lib/x86_64:/lib:/usr/lib/tls/x86_64:/usr/lib/tls:/usr/lib/x86_64:/usr/lib:/lib/x86_64-linux-gnu/tls/x86_64:/lib/x86_64-linux-gnu/tls:/lib/x86_64-linux-gnu/x86_64:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu/tls/x86_64:/usr/lib/x86_64-linux-gnu/tls:/usr/lib/x86_64-linux-gnu/x86_64:/usr/lib/x86_64-linux-gnu (system search path)
17166: trying file=/lib/tls/x86_64/libevent-1.4.so.2
17166: trying file=/lib/tls/libevent-1.4.so.2
17166: trying file=/lib/x86_64/libevent-1.4.so.2
17166: trying file=/lib/libevent-1.4.so.2
17166: trying file=/usr/lib/tls/x86_64/libevent-1.4.so.2
17166: trying file=/usr/lib/tls/libevent-1.4.so.2
17166: trying file=/usr/lib/x86_64/libevent-1.4.so.2
17166: trying file=/usr/lib/libevent-1.4.so.2
17166: trying file=/lib/x86_64-linux-gnu/tls/x86_64/libevent-1.4.so.2
17166: trying file=/lib/x86_64-linux-gnu/tls/libevent-1.4.so.2
17166: trying file=/lib/x86_64-linux-gnu/x86_64/libevent-1.4.so.2
17166: trying file=/lib/x86_64-linux-gnu/libevent-1.4.so.2
17166: trying file=/usr/lib/x86_64-linux-gnu/tls/x86_64/libevent-1.4.so.2
17166: trying file=/usr/lib/x86_64-linux-gnu/tls/libevent-1.4.so.2
17166: trying file=/usr/lib/x86_64-linux-gnu/x86_64/libevent-1.4.so.2
17166: trying file=/usr/lib/x86_64-linux-gnu/libevent-1.4.so.2
17166:
/usr/local/bin/fdfs_test: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory
最后我们通过 将已经安装好的软件包进行软连接 ,就可以将问题解决
ln -s /usr/local/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2