Question

I'm using libevent in my source code, after compiling the program, I run it and I got the following error:

./my_program: error while loading shared libraries: libevent-1.4.so.2: cannot open shared

previously I was at a loss on how to instal libevent and installed something like libverto-libevent-0.2.5-1.fc16.x86_64.rpm. Anyway, finally I compiled and installed the libevent source code by ./configure, make and make install, but it was installed in /usr/lib while /usr/lib64 is occupied by previous residue .so files, as below:

    [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]$

what can I do so I can run ./my_program successfully? my system is fedora 16, I want to link to libevent-1.4.so thanks!

BTW:

I tried to rpm -e all previously-wrongly-installed rpm package, there are some "the package is not installed" prompts, and I got

    [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
Was it helpful?

Solution

For Libraries installed from source you have to run ldconfig, packagemanagers do this for you. But if you build a library from source you have to run

./configure
make
make install 

but also

ldconfig

and both make install and ldconfig should be done as superuser

man ldconfig

can tell you way more about caching and updating the libraries then I can.

OTHER TIPS

can't u remove the libevent 2.0?

you can use rpm -e in rpm method.

or, in your Makefile you can link the libevent-2.0 rather than libevent-1.4.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top