Runtime error

Federico Stra feddy.stra at hotmail.it
Tue Jun 29 15:24:21 CEST 2010


Hello everybody,
I need help for I experience some troubles running programs compiled with the -lgmp option to link them to the libgmp library.

I installed gmp-5.0.1 by executing (as written in the manual):
   ./configure
   make
   make check
   make install

As a result, the following files have been added to /usr/local/lib:
   federico at federico-laptop:~$ ls /usr/local/lib/libgmp* -l
   -rw-r--r-- 1 root root 814790 2010-06-29 13:59 /usr/local/lib/libgmp.a
   -rwxr-xr-x 1 root root    917 2010-06-29 13:59 /usr/local/lib/libgmp.la
   lrwxrwxrwx 1 root root     16 2010-06-29 13:59 /usr/local/lib/libgmp.so -> libgmp.so.10.0.1
   lrwxrwxrwx 1 root root     16 2010-06-29 13:59 /usr/local/lib/libgmp.so.10 -> libgmp.so.10.0.1
   -rwxr-xr-x 1 root root 450955 2010-06-29 13:59 /usr/local/lib/libgmp.so.10.0.1

Now, I create a file main.c:
   #include <stdio.h>
   #include <gmp.h>
  
   int main() {
      printf("Done.\n");
   }

I compile it with the following command:
   gcc main.c -o main -lgmp

On execution, the program exits with the following error:
   federico at federico-laptop:~$ ./main
   ./main: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory

That seems to me a bit strange...
Anyway, if I compile the program with
    gcc main.c -o main -lgmp -static
instead, then it runs properly, because it doesn't need to link them upon runtime.
Is there any reason for this behavior? Shall I try to copy the libraries to /usr/lib, maybe?

Thank you in advance.
Federico 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969


More information about the gmp-discuss mailing list