1
votes

I think this is my problem with installing GCC. I keep getting

checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no

when I type

/Users/[username]/Documents/gcc-4.8.3/configure --with-gmp=/usr/local
--with-mpc=/usr/local --with-mpfr=/usr/local

with [username] being my actual username.

I installed GMP, MPC, and MPFR, but the files for the three are spread among different folders in /usr/local. All the header files are in /usr/local/include, but the library files are in /usr/local/lib.

1
It looks like you simply have incompatible versions of one or more of the libraries, just run the download_prerequisites script in the contrib folder of your source directory and then configure without the lib options.user657267
Should that be --with-mpfr=/usr/local?Ned Deily
@NedDeily Sorry, that was just a typo in my question.Geoffthebunchie

1 Answers

3
votes

You should be able to figure it out from this:

$ ~/src/gcc/gcc/configure --help | fgrep gmp
  --with-gmp-dir=PATH     this option has been REMOVED
  --with-gmp=PATH         specify prefix directory for the installed GMP
                          --with-gmp-include=PATH/include plus
                          --with-gmp-lib=PATH/lib
  --with-gmp-include=PATH specify directory for installed GMP include files
  --with-gmp-lib=PATH     specify directory for the installed GMP library

Also, https://gcc.gnu.org/install/prerequisites.html says

Alternatively, if GMP is already installed but it is not in your library search path, you will have to configure with the --with-gmp configure option. See also --with-gmp-lib and --with-gmp-include.

And of course, https://gcc.gnu.org/install/configure.html says

--with-gmp=pathname
--with-gmp-include=pathname
--with-gmp-lib=pathname
--with-mpfr=pathname
--with-mpfr-include=pathname
--with-mpfr-lib=pathname
--with-mpc=pathname
--with-mpc-include=pathname
--with-mpc-lib=pathname
If you want to build GCC but do not have the GMP library, the MPFR library and/or the MPC library installed in a standard location and do not have their sources present in the GCC source tree then you can explicitly specify the directory where they are installed (‘--with-gmp=gmpinstalldir’, ‘--with-mpfr=mpfrinstalldir’, ‘--with-mpc=mpcinstalldir’). The --with-gmp=gmpinstalldir option is shorthand for --with-gmp-lib=gmpinstalldir/lib and --with-gmp-include=gmpinstalldir/include. Likewise the --with-mpfr=mpfrinstalldir option is shorthand for --with-mpfr-lib=mpfrinstalldir/lib and --with-mpfr-include=mpfrinstalldir/include, also the --with-mpc=mpcinstalldir option is shorthand for --with-mpc-lib=mpcinstalldir/lib and --with-mpc-include=mpcinstalldir/include. If these shorthand assumptions are not correct, you can use the explicit include and lib options directly. You might also need to ensure the shared libraries can be found by the dynamic linker when building and using GCC, for example by setting the runtime shared library path variable (LD_LIBRARY_PATH on GNU/Linux and Solaris systems).

That should make it pretty obvious that it's completely normal, even expected, that the files will not all be in one directory. Almost all UNIX software installs header files and libraries in separate directories.

It's usually easier to build those libs in-tree and link GCC to them statically, as described at http://gcc.gnu.org/wiki/InstallingGCC