{{tag>gcc guide compile}} {{howhard>4}}
====== GCC 5.4.0 ======
This guide assumes you are switched to su - . Please note that during the make step you may run into issues check the missing aclocal-1.15 section , this guide assumes you are using the eSG provided installation image.

===== Goal =====
Build GCC 5.4.0

===== Steps =====
==== Building Pre requisites ====
<sxh>
cd ~
mkdir buildgcc
cd ~/buildgcc
</sxh>

==== Library Prerequisites ====
<sxh>yum groupinstall "Development tools"
yum install glibc-devel.i686 glibc.i686 texinfo</sxh>

==== EXPORTS used to set versions ====
You can change the values here to change the compiled version.
<sxh>MPC_VERSION=1.1.0
MPFR_VERSION=4.0.0
GMP_VERSION=6.1.2
ISL_VERSION=0.18
CLOOG_VERSION=0.18.1
GCC_VERSION=5.4.0</sxh>

==== Fetch MPC ====
<sxh>wget ftp://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz
tar zxfv mpc-${MPC_VERSION}.tar.gz</sxh>

==== Fetch MPFR ====
<sxh>wget http://www.mpfr.org/mpfr-current/mpfr-${MPFR_VERSION}.tar.bz2
tar jxfv mpfr-${MPFR_VERSION}.tar.bz2</sxh>

==== Fetch GMP ====
<sxh>wget https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.bz2
tar jxfv gmp-${GMP_VERSION}.tar.bz2</sxh>

==== Fetch ISL ====
<sxh>wget ftp://ftp.ntua.gr/pub/gnu/gcc/infrastructure/isl-${ISL_VERSION}.tar.bz2
tar jxfv isl-${ISL_VERSION}.tar.bz2</sxh>

==== Fetch CLOOG ====
<sxh>wget ftp://ftp.ntua.gr/pub/gnu/gcc/infrastructure/cloog-${CLOOG_VERSION}.tar.gz
tar zxfv cloog-${CLOOG_VERSION}.tar.gz</sxh>

==== Fetch GCC ====
<sxh>wget ftp://ftp.ntua.gr/pub/gnu/gcc/releases/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.bz2
tar jxfv gcc-${GCC_VERSION}.tar.bz2</sxh>

==== Copy downloaded libraries in GCC directory ====
<sxh>cd gcc-${GCC_VERSION}
cp -R ../mpc-${MPC_VERSION} mpc
cp -R ../mpfr-${MPFR_VERSION} mpfr
cp -R ../gmp-${GMP_VERSION} gmp
cp -R ../isl-${ISL_VERSION} isl
cp -R ../cloog-${CLOOG_VERSION} cloog</sxh>

==== Hardcoded autoconf ====
Since autoconf is hardcoded you need to update to your own version
Find your version using:
<sxh>rpm -qa | grep autoconf</sxh>
example: autoconf-2.69-11.el7.noarch, thus you have version 2.69 .

Find the following line in config/override.m4
<sxh>m4_ifndef([_GCC_AUTOCONF_VERSION],
  [m4_define([_GCC_AUTOCONF_VERSION], [2.69])])</sxh>
and change the version to your own

==== missing aclocal-1.15 ====
Since your version of aclocal may be different you should autoreconf using:
<sxh>autoreconf -ivf 
autoreconf -ivf mpfr/
autoreconf -ivf isl/
autoreconf -ivf cloog/</sxh>

==== Configure GCC ====
<sxh>./configure --prefix=/opt/gcc-${GCC_VERSION} --enable-multilib --with-system-zlib</sxh>

==== Make GCC ====
<wrap em>Warning: This process will take quite a few hours, make sure the build is started in a multiplexer (eg tmux)</wrap>
<sxh>make</sxh>

==== Install GCC ====
<sxh>make install</sxh>
This will install GCC in the path you set in configure with --prefix=
