problem with using shared library of GMP 5.0.1

Paul Zimmermann Paul.Zimmermann at loria.fr
Fri Sep 3 10:00:37 CEST 2010


       Torbjörn,

> If you are building a MPFR shared library, you need to use -fPIC (or
> -fpic) with GCC when compiling MPFR.  GMP uses -fPIC, as you can see
> from a GMP build log.  You also need to link to GMP's shared library,
> not the static library.
> 
> If you add -fPIC to CFLAGS when compiling GMP, you will compile also the
> static library with PIC code, which is harmless except that it will slow
> things down.  (The shared library will then be compiled with -fPIC
> -fPIC.)

sorry for the false alarm. The problem only occurs when I configure GMP with
--disable-shared, and MPFR without any shared/static option:

cd /tmp
/bin/rm -fr gmp-5.0.1*
/bin/rm -fr /tmp/include /tmp/lib
tar jxf ~/download/gmp-5.0.1.tar.bz2
cd gmp-5.0.1
./configure --prefix=/tmp --disable-shared
make -j
make install
cd /tmp
/bin/rm -fr mpfr-3.0.0*
tar jxf ~/download/mpfr-3.0.0.tar.bz2
cd mpfr-3.0.0
./configure --with-gmp=/tmp
make -j

It seems the MPFR configure tries to still build a shared library, even if no
shared GMP library exists. I will report this bug to the MPFR developers :-)

Paul


More information about the gmp-bugs mailing list