gmp 4.2.1 version

Marc Glisse marc.glisse at
Tue Jul 31 12:12:52 CEST 2007

On Mon, 30 Jul 2007, Orit Harel wrote:

> During our link time when gmp library is an input to this link command,
> we got the following:
> ld: fatal: relocation error: R_SPARC_H44: file
> /usr/local64/gmp-4.2.1/lib/libgmp.a(mp_set_fns.o): symbol
> __gmp_default_allocate: relocations
> based on the ABS44 coding model can not be used in building a shared
> object
> Adding the -K PIC flag to gmp library build has solved the problem.
> My question is:
> Is this the correct solution? How it will affect on the gmp usage ?

It is not the best way. There are two types of libraries: static and 
shared. For gmp you can build both (see the configure options). Linking 
with a shared library (lib*.so) means adding a runtime dependancy on this 
library. Linking with a static library or archive (lib*.a) means including 
relevant portions of this library in the object that is produced. To make 
it simple, only link the executable file with the static libraries. Here 
you are building a shared object so you should not link with a static 
library, you can either not link with gmp at all (and remember to link 
with gmp when you create an executable file using this shared object) or 
link with a shared version of libgmp.

Marc Glisse

More information about the gmp-bugs mailing list