Previously on our blog we described how to install the GNU C compiler. Since then GNU have updated their installation instructions which makes things much easier:
“The difficult way, which is not recommended, is to download the sources for GMP, MPFR and MPC, then configure and install each of them in non-standard locations, then configure GCC with –with-gmp=/some/silly/path/gmp –with-mpfr=/some/silly/path/mpfr –with-mpc=/some/silly/path/mpc, then be forced to set LD_LIBRARY_PATH=/some/silly/path/gmp:/some/silly/path/mpfr:/some/silly/path/mpc/lib in your environment forever. This is silly and causes major problems for anyone who doesn’t understand how dynamic linkers find libraries at runtime. Do not do this. If building GCC fails when using any of the –with-gmp or –with-mpfr or –with-mpc options then you probably shouldn’t be using them.”
In choosing the non-silly install method we did the following:
tar zxvf gcc-5.3.0.tar.gz cd gcc-5.3.0 ./contrib/download_prerequisites cd .. mkdir objdir cd objdir $PWD/../gcc-5.3.0/configure --prefix=<$DEST>/gcc-5.3.0 --enable-stage1-languages=all --disable-multilib make -j 15 make install
Notes:
– $DEST should be something like $HOME/compilers
– Do this on a worker node with as many cores as you can. Set “make -j X” where X is the number of cores you’ve reserved. This does the compile in parallel which is much faster
– –disable-multilib means that the 32bit libc libraries and headers are not included and only a 64bit compiler is built.