Installing GCC 7.2.0 on RHEL7

For compatibility with another SDK I’m using, I have to use GCC 7.2.0 (RHEL devtoolset-7 provides GCC 7.3 at the time of this writing). So it should also be noted that I’m using GCC 7.3.1 to compile GCC 7.2.0; although the instructions should be generally applicable to other combinations. Notes on installing devtoolset-7: RHEL7 devtoolset-7

sudo yum -y install make bison flex gmp-devel  libmpc-devel mpfr-devel texinfo
wget https://ftp.gnu.org/gnu/gcc/gcc-7.2.0/gcc-7.2.0.tar.gz
tar xf gcc-7.2.0.tar.gz && cd gcc-7.2.0
mkdir build && cd build && ../configure --enable-languages=c,c++ --disable-multilib
make -j$(nproc)
sudo make install
echo "export PATH=/usr/local/bin:\$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/lib64:\$LD_LIBRARY_PATH" >> ~/.bashrc
source ~/.bashrc
gcc --version

 

2 thoughts on “Installing GCC 7.2.0 on RHEL7”

  1. Pingback: Installing boost on RHEL7/CentOS7 – GeoHub

Leave a Comment