Help requested

Marc Glisse marc.glisse at
Wed Mar 7 20:59:46 CET 2012

On Wed, 7 Mar 2012, Ernst Berg wrote:

> Hello Friends..
> I just upgraded hardware and OS and am not sure what to do to get GMP running
> right. It is my fault that my experience level is not so high with solving
> problems but, it is better to ask for help then to hack things to death here.
> I installed GMP gmp-5.0.4 as I have before except before was on Fedora and now I
> own RHEL6.

First: your OS comes with a package manager that will let you install gmp 
in one click (maybe 2). Is there a particular reason you want to install 
it by hand?

> The issue is :
>  gcc -o attractor_finder attractor_finder.c -lgmp -static
> /usr/bin/ld: cannot find -lc
> collect2: ld returned 1 exit status

Why the -static? Just drop it (or install the package glibc-static).

> ./attractor_finder
> ./attractor_finder: error while loading shared libraries: cannot
> open shared object file: No such file or directory

Ah, now I see why you tried -static. If you want only gmp linked 
statically, you can use:
-Bstatic -lgmp -Bdynamic
or directly the file name:

> Which I read :
> Libraries have been installed in:
>   /usr/local/lib
> If you ever happen to want to link against installed libraries
> in a given directory, LIBDIR, you must either use libtool, and
> specify the full pathname of the library, or use the `-LLIBDIR'
> flag during linking and do at least one of the following:
>   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
>     during execution
>   - add LIBDIR to the `LD_RUN_PATH' environment variable
>     during linking
>   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
>   - have your system administrator add LIBDIR to `/etc/'
> So since I am the system administrator and I am unsure what to add to what and
> where I am asking for advice.

Does your file /etc/ contain a line:

If not, add it (and maybe run ldconfig).

Marc Glisse

More information about the gmp-discuss mailing list