Skip to content

Instantly share code, notes, and snippets.

@Black-Milk
Created November 7, 2019 03:52
Show Gist options
  • Save Black-Milk/890b448ec3b4f6a6fb61468014a653e3 to your computer and use it in GitHub Desktop.
Save Black-Milk/890b448ec3b4f6a6fb61468014a653e3 to your computer and use it in GitHub Desktop.
Install GCC 4.8 for Linux without Root
#!/bin/bash
INSTALL_PATH=<your_local_install_path_goes_here>
curl -LO https://mirrors.kernel.org/gnu/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2
tar xf gcc-4.8.5.tar.bz2
mkdir build
cd gcc-4.8.5
MPFR=mpfr-2.4.2
GMP=gmp-4.3.2
MPC=mpc-0.8.1
wget http://gcc.gnu.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1
tar xjf $MPFR.tar.bz2 || exit 1
ln -sf $MPFR mpfr || exit 1
wget http://gcc.gnu.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1
tar xjf $GMP.tar.bz2 || exit 1
ln -sf $GMP gmp || exit 1
wget http://gcc.gnu.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1
tar xzf $MPC.tar.gz || exit 1
ln -sf $MPC mpc || exit 1
cd ..
cd build
../gcc-4.8.5/configure --build=x86_64-linux-gnu --prefix=$INSTALL_PATH \
--enable-checking=release --enable-languages=c,c++,fortran \
--disable-multilib --program-suffix=-4.8
make -j 20
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment