加载共享库时出现错误,安装错误.所以/usr/lib中的文件



我在源代码中使用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

对于从源代码安装的库,您必须运行ldconfig,包管理器会为您完成此操作。但是如果你从源代码构建一个库,你必须运行

./configure
make
make install 

,还

ldconfig

make installldconfig都应该使用超级用户

man ldconfig

不能删除libevent 2.0吗?

可以在RPM方法中使用RPM -e。

或者,在您的Makefile中,您可以链接libevent-2.0而不是libevent-1.4。

相关内容

  • 没有找到相关文章

最新更新