GCC cant find GMP, MPFR and MPC libraries

I suspect that the problem may be that the libraries are for 32-bit when you are attempting to build a 64-bit compiler, or vice versa.

I was able to build GCC 4.5.1 on MacOS X 10.6.4 recently, but I built and installed the GMP, MPFR and MPC libraries myself - in /usr/gnu64 (a non-standard location that I use for stuff that I install for my own benefit). I also used the configuration option:

CC='gcc -m64'

to force a 64-bit build. I had similar problems on Linux (plus a problem with a regex in opt-functions.awk - easily fixed with two back-slashes in front of an open brace) and found that there were updates to the MPFR and MPC libraries since I built on MacOS X:

  • GMP 5.0.1 (instead of 4.2.4)
  • MPC 0.8.2 (instead of 0.8.1)
  • MPFR 3.0.0 (instead of 2.4.2)

Since I wrote this, I've changed my methodology somewhat. What I now do is documented in Install GNU GCC on Mac. Basically, I get the current versions of GMP, MPC, MPFR and put their source code into the GCC source directory, and let GCC compile the libraries for itself. This makes GCC deal with locating the libraries.


You should use

--with-gmp=/usr/local/include \
    --with-mpfr=/usr/local/include --with-mpc=/usr/local/include

instead of

--with-gmp=/usr/local \
    --with-mpfr=/usr/local --with-mpc=/usr/local

I had the same problem trying to compile gcc-4.6.0 on OX 10.6.6. I was using gmp-4.3.2 ; using instead gmp-5.0.1, the configure script appears to correctly guess "CC=gcc -std=gnu99 CFLAGS=-O2 -pedantic -m64 -mtune=core2 -march=core2", and passes that on to mpfr (3.0.1) and mpc (0.9) , so anyone using these or more recent versions shouldn't get this error.