Bill Allombert on Mon, 14 Apr 2008 22:36:16 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: error while loading shared libraries


On Mon, Apr 14, 2008 at 06:06:00PM +0200, Jean-Marc Sac-Epee wrote:
> Hello !
> 
> Always using gp-pari in gp-mode, I now need to use it in library mode.
> 
> With a simple C program premier.c and the classical Makefile :
> 
> [jm@localhost Pari]$ make
> cc -O -I/usr/local/include/pari  -L/usr/local/lib -o premier premier.c 
> -lpari -lm
> [jm@localhost Pari]$
> 
> But after that, I get :
> 
> [jm@localhost Pari]$ ./premier
> ./premier: error while loading shared libraries: libpari.so.2: cannot 
> open shared object file: No such file or directory
> 
> Well, I installed Pari with ./Configure --> make --> make install  and 
> all  seemed OK.

This is a problem with the dynamic loader: maybe it does not search
/usr/local/lib by default.

You can use 'ldd ./premier' to check the dynamic loader behaviour.

You can add /usr/local/lib to the dynamic loader search path by
issuing 
export LD_LIBRARY_PATH=/usr/local/lib
(or setenv LD_LIBRARY_PATH /usr/local/lib if you use tcsh)

> In another PC (under Linux Mandriva 2008.0), I also tried an 
> installation with urpmi
> 
> [root@kbamur ~]# urpmi pari
> Pour satisfaire les dépendances, les paquetages suivants vont être 
> installés
>  Paquetage                      Version      Révision      Arch
> (média « contrib »)
> libpari1                       2.1.7        3mdv2007.0    i586
> pari                           2.1.7        3mdv2007.0    i586

Version 2.1.7 is terribly outdated and come with libpari.so.1

> installation de pari-2.1.7-3mdv2007.0.i586.rpm 
> libpari1-2.1.7-3mdv2007.0.i586.rpm depuis /var/cache/urpmi/rpms
> Préparation ...                  
> #############################################
>     1/2: libpari1              
> #############################################
>     2/2: pari                  
> #############################################
> [root@kbamur ~]#   
> As you can see, all is OK too, but I also got a "error while loading 
> shared libraries: libpari.so.2..." when trying to run a program.

You compiled your binary against libpari.so.2 but you installed
libpari.so.1, so this fails.

Cheers,
Bill.