Zimmermann Paul Paul.Zimmermann at
Sat Jan 18 10:00:38 UTC 2014


I finally managed to configure MPFR with mini-gmp, and run make and make check.

I had to disable about 15 tests which use either mpf_t or mpq_t.

All the 155 remaining tests pass, except one (texp), I need to investigate.
But so far I found no bug in mini-gmp. Good!

I had to do a few changes in mini-gmp (see below), in particular I had to do
a real "make install", otherwise it is not possible to compile a library like

Also I had to implement several functions which are not provided by mini-gmp.
See the files mpfr-mini-gmp.h and mpfr-mini-gmp.c in the MPFR svn repository.
The most wanted are the mpn division functions, I wonder why those functions
are not exported.


How to compile GNU MPFR with mini-gmp

(this was tested with MPFR 3.1.2 and GMP 5.1.3 on x86_64 GNU/Linux machine)

1) extract the GMP tarball in say /tmp/gmp-5.1.3
   go into /tmp/gmp-5.1.3/mini-gmp
   add the following line in mini-gmp.c (say at line 43):
   char gmp_version[] = "5.1.3";
   gcc -O2 -g -fPIC -c mini-gmp.c
   ar r libgmp.a mini-gmp.o

2) create a GMP install directory in say /tmp
   mkdir /tmp/include
   mkdir /tmp/lib
   mv libgmp.a /tmp/lib
   cp mini-gmp.h /tmp/include/gmp.h

3) do the following changes in /tmp/include/gmp.h:

$ diff gmp.h.orig gmp.h
> #define __GNU_MP_VERSION            5
> #define __GNU_MP_VERSION_MINOR      1
> extern char gmp_version[];
> #endif
> /* random generation functions */
> #ifndef gmp_randstate_t
> typedef long int __gmp_randstate_struct;
> typedef __gmp_randstate_struct gmp_randstate_t[1];

4) extract the MPFR tarball in say /tmp/mpfr-3.1.2
   ./configure --with-gmp=/tmp --enable-mini-gmp

More information about the gmp-devel mailing list