How to build gcc 4.7.2 on CentOS 6 x64

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

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

And I get the 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 is the reason? Libraries are being built, the correct location, header files are recognized, but the 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.

+4
source share
3 answers

Thank you, I researched myself; the problem is that CentOS 6 has pre-installed old versions of GMP / MPFR / MPC, and they ran into my new built-in libraries.

+1
source

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

First you need to install Python and bzr.

Then after setting up (steps in the gsrc web page) just do it in the gsrc directory

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

+5
source

Someone made a script to do this. It solves the problem of the dependence of libraries on these libraries and dependencies among themselves. http://joelinoff.com/blog/?p=811

It worked for me with some minor modifications, but as a result, gcc has a whacky link path (it generates binary files that are still looking for libstdC ++, therefore, on normal system paths containing old libraries. I have a question on this issue:

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

0
source

Source: https://habr.com/ru/post/1436223/


All Articles