Skip to content

Instantly share code, notes, and snippets.

@snlawrence
Forked from jdhao/gcc-5.4.0-install.sh
Last active June 3, 2020 00:08
Show Gist options
  • Save snlawrence/f199fe9434f6ddea715f0cd798f4b530 to your computer and use it in GitHub Desktop.
Save snlawrence/f199fe9434f6ddea715f0cd798f4b530 to your computer and use it in GitHub Desktop.
The script will install GCC 5.4.0 on your CentOS 7 system, you can modify the prefix directory on line 13 to suit your preferences. See https://jdhao.github.io/2017/09/04/install-gcc-newer-version-on-centos/ for more details.
echo "Downloading gcc source files..."
curl https://ftp.gnu.org/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.bz2 -O
echo "extracting files..."
tar xvfj gcc-5.4.0.tar.bz2
echo "Installing dependencies..."
yum -y install gmp-devel mpfr-devel libmpc-devel gcc-c++
echo "Configure and install..."
mkdir gcc-5.4.0-build
cd gcc-5.4.0-build
../gcc-5.4.0/configure --enable-languages=c,c++ --disable-multilib --prefix=$HOME/Programs/gcc-5.4.0
make -j$(nproc) && make install
echo "Install complete."
echo "You should the following to your ~/.bashrc:"
echo "export LD_LIBRARY_PATH=\"/path/to/install/lib64:$LD_LIBRARY_PATH\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment