我在我的源代码中使用libevent,在编译程序之后,我运行它并得到以下错误:
./my_program: error while loading shared libraries: libevent-1.4.so.2: cannot open shared
之前我对如何安装libevent并安装类似libverto-libevent-0.2.5-1.fc16.x86_64.rpm
的东西感到茫然。无论如何,最后我按./configure, make and make install
编译并安装了libevent源代码,但它安装在/usr/lib
中,而/usr/lib64
被前面的残留.so文件占用,如下所示:
[esolve@kity lib]$ ls /usr/lib64|grep "libevent"
libevent-2.0.so.5
libevent-2.0.so.5.0.1
libevent_core-2.0.so.5
libevent_core-2.0.so.5.0.1
libevent_extra-2.0.so.5
libevent_extra-2.0.so.5.0.1
libevent_openssl-2.0.so.5
libevent_openssl-2.0.so.5.0.1
libevent_pthreads-2.0.so.5
libevent_pthreads-2.0.so.5.0.1
libeventviews.so.4
libeventviews.so.4.8.0
[esolve@kity lib]$ ls /usr/lib|grep "libevent"
libevent-1.4.so.2
libevent-1.4.so.2.2.0
libevent.a
libevent_core-1.4.so.2
libevent_core-1.4.so.2.2.0
libevent_core.a
libevent_core.la
libevent_core.so
libevent_extra-1.4.so.2
libevent_extra-1.4.so.2.2.0
libevent_extra.a
libevent_extra.la
libevent_extra.so
libevent.la
libevent.so
[esolve@kity lib]$
我能做什么才能成功运行./my_program?
我的系统是fedora 16,我想链接到libevent-1.4.so
谢谢!
顺便说一句:
我试过rpm -e所有以前错误安装的rpm包,有一些“没有安装包”的提示,我得到了
[esolve@kity lib]$ ls /usr/lib64|grep "libevent"
lrwxrwxrwx 1 root root 21 Apr 3 2012 libevent-2.0.so.5 -> libevent-2.0.so.5.0.1
-rwxr-xr-x 1 root root 280720 Feb 9 2011 libevent-2.0.so.5.0.1
lrwxrwxrwx 1 root root 26 Apr 3 2012 libevent_core-2.0.so.5 -> libevent_core-2.0.so.5.0.1
-rwxr-xr-x 1 root root 165760 Feb 9 2011 libevent_core-2.0.so.5.0.1
lrwxrwxrwx 1 root root 27 Apr 3 2012 libevent_extra-2.0.so.5 -> libevent_extra-2.0.so.5.0.1
-rwxr-xr-x 1 root root 127400 Feb 9 2011 libevent_extra-2.0.so.5.0.1
lrwxrwxrwx 1 root root 29 Apr 3 2012 libevent_openssl-2.0.so.5 -> libevent_openssl-2.0.so.5.0.1
-rwxr-xr-x 1 root root 21352 Feb 9 2011 libevent_openssl-2.0.so.5.0.1
lrwxrwxrwx 1 root root 30 Apr 3 2012 libevent_pthreads-2.0.so.5 -> libevent_pthreads-2.0.so.5.0.1
-rwxr-xr-x 1 root root 6992 Feb 9 2011 libevent_pthreads-2.0.so.5.0.1
lrwxrwxrwx 1 root root 22 Jul 31 2012 libeventviews.so.4 -> libeventviews.so.4.8.0
-rwxr-xr-x 1 root root 974656 Jul 9 2012 libeventviews.so.4.8.0
答案 0 :(得分:1)
对于从源安装的库,您必须运行ldconfig,packagemanagers会为您执行此操作。但是,如果您从源代码构建库,则必须运行
./configure
make
make install
但也
ldconfig
并且make install
和ldconfig
都应以超级用户身份完成
man ldconfig
可以告诉你更多关于缓存和更新库的信息,然后我可以。
答案 1 :(得分:0)
你不能删除libevent 2.0吗?
你可以在rpm方法中使用rpm -e。
或者,在Makefile中,您可以链接libevent-2.0而不是libevent-1.4。