Compiling GCC 4.7.2 on CentOS 5


Step 1: Download the following prerequistics applications libraries from ftp://gcc.gnu.org/pub/gcc/infrastructure/

  1. gmp-4.3.2.tar.bz2
  2. mpfr-2.4.2.tar.bz2
  3. mpc-0.8.1.tar.gz

1. Install gmp-4.3.2

# bunzip2 gmp-4.3.2.tar.bz2
# tar -zxvf gmp-4.3.2.tar
# cd gmp-4.3.2
# ./configure --prefix=/usr/local/gmp-4.3.2
# make
# make install

2. Install mpfr-2.4.2 (requires gmp-4.3.2 as prerequisites)

# bunzip2 mpfr-2.4.2.tar.bz2
# tar -zxvf mpfr-2.4.2.tar
# cd mpfr-2.4.2
# ./configure --prefix=/usr/local/mpfr-2.4.2 --with-gmp=/usr/local/gmp-4.3.2/
# make
# make install

3. Install mpc-0.8.1 (requires gmp-4.3.2 and mpfr-2.4.2 as prerequisites )

# tar -zxvf mpc-0.8.1.tar.gz
# cd mpc-0.8.1
#./configure --prefix=/usr/local/mpc-0.8.1/ --with-gmp=/usr/local/gmp-4.3.2/ --with-mpfr=/usr/local/mpfr-2.4.2
# make
# make install

4. Update your LD_LIBRARY_PATH at your ~/.bashrc

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-0.8.1:/usr/local/mpfr-2.4.2/lib:/usr/local/gmp-4.3.2/lib

5. Install the glibc-devel.i686. For more information, do look at Error when compiling GCC 4.8.1 (linuxtoolkit.blogspot.com)

6. Finally install GNU CC 4.7.2

# tar -zxvf  gcc-4.7.2.tar.gz
# cd gcc-4.7.2
# mkdir build-gcc
# cd build-gcc
# ../configure --prefix=/usr/local/gcc-4.7.2 \ 
--with-mpfr=/usr/local/mpfr-2.4.2 \ 
--with-mpc=/usr/local/mpc-0.8.1 \
--with-gmp=/usr/local/gmp-4.3.2 \
--with-mpfr-include=/usr/local/mpfr-2.4.2/include \
--with-mpc-include=/usr/local/mpc-0.8.1/include
# make all-gcc
# make install-gcc
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.