Reputation: 3688
I'm trying to update GCC on a particular linux machine I have, to a version for which there is no package available.
I run the configure script and it complains about the version of GMP:
# ../gcc/configure
checking build system type... i686-pc-linux-gnu
[snip]
checking for the correct version of gmp.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations. Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also
http://gcc.gnu.org/install/prerequisites.html for additional info. If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files. They may be located in separate packages.
However, when I check gmp.h it shows:
/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
#define __GNU_MP_VERSION 4
#define __GNU_MP_VERSION_MINOR 2
#define __GNU_MP_VERSION_PATCHLEVEL 1
and RPM reports the following:
# rpm -q --qf "%{VERSION}\n" gmp
4.2.1
# rpm -q --qf "%{VERSION}\n" gmp-devel
4.2.1
so both library and headers seem to be of a correct version to me (confusingly, the numbering of the .so file for libgmp seems to have exactly nothing to do with the version number... that is showing as
libgmp.so -> libgmp.so.3.4.1
Does anyone know why this might be failing? Those are the only two gmp packages installed on this machine and they are in standard /usr/include and /usr/lib locations, so they should be on the search path already.
Upvotes: 0
Views: 1656
Reputation: 3688
Turns out that "Building GCC requires GMP 4.2+" is insufficiently detailed. Digging into configure, it's actually checking:
#if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
choke me
#endif
i.e. GMP 4.2 .3 or greater, so my 4.2.1 wasn't cutting it.
Upvotes: 0
Reputation: 86
Please read Installing GCC:
The difficult way, which is not recommended, is to download the sources for GMP, MPFR and MPC, then configure and install each of them in non-standard locations, then configure GCC with --with-gmp=/some/silly/path/gmp --with-mpfr=/some/silly/path/mpfr --with-mpc=/some/silly/path/mpc, then be forced to set LD_LIBRARY_PATH=/some/silly/path/gmp:/some/silly/path/mpfr:/some/silly/path/mpc/lib in your environment forever. This is silly and causes major problems for anyone who doesn't understand how dynamic linkers find libraries at runtime. Do not do this. If building GCC fails when using any of the --with-gmp or --with-mpfr or --with-mpc options then you probably shouldn't be using them.
Just run ./contrib/download_prerequisites
and save yourself a lot of time and pain.
Upvotes: 1