程序编译成功后,运行时错误:
error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
解决方法:
像libevent这种开源库,编译安装后,一般在/usr/local/lib目录下,可以通过下列命令查找:
#whereis libevent-2.0.so.5
libevent-2.0.so: /usr/local/lib/libevent-2.0.so.5
如果是自己编写的库,whereis是找不到的,当然自己也是知道该库在哪个地方的。
找到该库后,做一个软连接或者直接将该文件拷贝至相应lib库。
ln -s /usr/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
或者
cp /usr/local/lib/libevent-2.0.so.5 /usr/lib