Skip to content

Instantly share code, notes, and snippets.

@kevinkjt2000
Created May 29, 2019 03:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinkjt2000/06f625780751e8ff36f3d76747c9e2fe to your computer and use it in GitHub Desktop.
Save kevinkjt2000/06f625780751e8ff36f3d76747c9e2fe to your computer and use it in GitHub Desktop.
#!/bin/bash
NUM_THREADS=8 #number of threads to use while making gcc
wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
echo 'Extracting downloaded files... (This might take a while)'
for f in *.tar*; do tar xf $f; done
cd gcc-4.9.2
ln -s ../gmp-4.3.2 gmp
ln -s ../mpc-0.8.1 mpc
ln -s ../mpfr-2.4.2 mpfr
cd ..
#need to build outside the source tree
mkdir build-gcc
cd build-gcc
#setting a -rpath option in .bash_profile will screw up configure
../gcc-4.9.2/configure --prefix=$HOME/.local/gcc-4.9.2 --enable-languages=c,c++ --disable-multilib
#unsetting all these special variables helps make gcc
# http://stackoverflow.com/questions/12255058/g-4-7-1-compilation-error-conflicting-types-for-strsignal
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
nice -n 19 time make -j $NUM_THREADS
#!/bin/bash
NUM_THREADS=8 #number of threads to use while making gcc
wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-5.3.0/gcc-5.3.0.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
echo 'Extracting downloaded files... (This might take a while)'
for f in *.tar* ; do pv $f | tar xf - ; done
cd gcc-5.3.0
ln -s ../gmp-4.3.2 gmp
ln -s ../mpc-0.8.1 mpc
ln -s ../mpfr-2.4.2 mpfr
cd ..
#need to build outside the source tree
mkdir build-gcc
cd build-gcc
#setting a -rpath option in .bash_profile will screw up configure
../gcc-5.3.0/configure --prefix=$HOME/.local/gcc-5.3.0 --enable-languages=c,c++ --disable-multilib
#unsetting all these special variables helps make gcc
# http://stackoverflow.com/questions/12255058/g-4-7-1-compilation-error-conflicting-types-for-strsignal
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE
nice -n 19 time make -j $NUM_THREADS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment