Vitalii
Vitalii

Reputation: 4793

How to build gcc 4.7.2 on CentOS 6 x64

I am trying to build latest (at the moment of writing this) GCC version on CentOS. I downloaded & built GMP, MPFR and MPC. These libraries are located under /usr/local (i. e. usr/local/lib for libraries and /usr/local/include for includes). Now I am trying to configure GCC to build with following command:

./configure --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local

And I get following error message:

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
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations.

What may be the reason? Libraries are build, location is correct, header files are recognized, but libraries themselves are not. I also tried this:

./configure --with-gmp-lib=/usr/local/lib \
--with-mpfr-lib=/usr/local/lib --with-mpc-lib=/usr/local/lib

But the result is the same.

Upvotes: 4

Views: 8151

Answers (3)

DanielY
DanielY

Reputation: 361

Highly recommend using GCC SRC (http://www.gnu.org/software/gsrc/)

You need to have Python and bzr installed first.

Then after configuration (steps in gsrc webpage), simply do these in the gsrc directory

make -C gnu/gcc
make -C gnu/gcc install

Upvotes: 5

Joshua Chia
Joshua Chia

Reputation: 1968

Someone's made a script to do that. It addresses the issue of library dependencies on these libraries and dependencies among themselves. http://joelinoff.com/blog/?p=811

It worked for me with some minor modification, but the resulting gcc has whacky link path (it generates binaries that still look for libstdc++.so in the regular system paths which contain old libraries. I have a question on this:

How to build and install gcc with built-in rpath?

Upvotes: 0

Vitalii
Vitalii

Reputation: 4793

thanks, I investigated myself; the problem is that in CentOS 6 there are pre-installed old versions of GMP/MPFR/MPC, and they conflicted with my new built libraries.

Upvotes: 1

Related Questions