0

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
user138126
  • 953
  • 3
  • 14
  • 29

2 Answers2

2

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.

hetepeperfan
  • 4,292
  • 1
  • 29
  • 47
  • BTW, can I remove all the `.so` files in /usr/lib64 which are related to libevent? because I only need libevent-1.4.so – user138126 May 20 '13 at 22:06
  • I believe ldconfig tells the linker where to find the libraries and does some other stuff, but see the manpages. I'm puzzeled by the fact that your libraries ended up in /usr/lib I would have expected them in /usr/local/lib unless you specified somting strange to the prefix variable while configuring/installing. – hetepeperfan May 20 '13 at 22:06
  • ah, I did something like: ./configure –prefix=/usr, I also want to use `gcc -m32 -o` for compiling my program, my machine is x86_64. what libevent libraries should I install. and will the `/usr/lib` affect the 32-bit version of the libevent library? – user138126 May 20 '13 at 22:11
  • @user138126 I would say run make uninstall as root and configure you program at let the configure script do the work for you because then the prefix will default to /usr/local build it again install it again. Don't forget ldconfig aswell cheers and goodnight. – hetepeperfan May 20 '13 at 22:17
0

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.

freedoo
  • 691
  • 1
  • 5
  • 12