Skip to content

Instantly share code, notes, and snippets.

@om23
Forked from jtilly/install-gcc-4.9.3.sh
Last active January 16, 2018 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save om23/2bc380f294e64982221cf4be4804809b to your computer and use it in GitHub Desktop.
Save om23/2bc380f294e64982221cf4be4804809b to your computer and use it in GitHub Desktop.
Install GCC
#!/bin/bash
# this script installs GCC <4.9.3>
# to use it navigate to your home directory and type:
# sh install-gcc-4.9.3.sh
# set what you want it build with
export CC=gcc-4.8
export CXX=g++-4.8
# download and install gcc 4.9.3
wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.3/gcc-4.9.3.tar.gz
tar xzf gcc-4.9.3.tar.gz
cd gcc-4.9.3
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
make distclean
../gcc-4.9.3/configure --prefix=$HOME/gcc-4.9.3 --enable-languages=c,c++,fortran,go --disable-multilib
make
# install
make install
# clean up
rm -rf ~/objdir
rm -f ~/gcc-4.9.3.tar.gz
# add to path (you may want to add these lines to $HOME/.bash_profile)
export PATH=$HOME/gcc-4.9.3/bin:$PATH
export LD_LIBRARY_PATH=$HOME/gcc-4.9.3/lib:$HOME/gcc-4.9.3/lib64:$LD_LIBRARY_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment