The FLAMES clusters are somewhat old and the installed compiler toolchain is somewhat old. I use the following toolchain to compile LAMMPS and DAKOTA. I will work on a new toolchain for VASP as well.
These directions were made on October 2015. The choice to select GCC 4.9.3 is based on it being the most recent stable build at this time. The 4.7 branch was not updated in June 2015, indicating that the 4.7.x branch will probably not be updated. This are the steps I did to compile GCC 4.9.3 on Hermes
Make a directory to hold gcc
mkdir ~/gcc_hold
cd ~/gcc_hold
Download Source Code from GNU
Obtain the latest releases from the GCC website, the latest releases can be found at GCC Releases. Place the tarball into the hold directory indicated in the step before and untar the distribution, and enter the distribution directory
tar -zxvf gcc-4.9.3.tar.gz
cd ~/gcc_hold/gcc-4.9.3
A script exists to get the prerequisites
contrib/download_prerequisites
Make a 4.9.3_build directory
mkdir ~/gcc_hold/4.9.3_build
cd ~/gcc_hold/4.9.3_build
I'm installing gcc into my home directory, which is the reason ~/usr/local/gcc/4.9.3 is chosen as the install location.
../gcc-4.9.3/configure --prefix=~/usr/local/gcc/4.9.3 --enable-multilib --enable-languages=c,c++,fortran
make bootstrap
Compiler Flags
GCC_VERSION = 4.9.3
GCC_PREFIX=~/usr/local/gcc/${GCC_VERSION}/bin/
CC=${GCC_PREFIX}gcc
CPP=${GCC_PREFIX}g++
References:
[1] http://www.tellurian.com.au/whitepapers/multiplegcc.php
[2] https://trilinos.org/about/getting-started/installing-gcc/
MPI ENVIRONMENTS
OpenMpi
MPI_INC = /opt/openmpi/bin/mpic++
MPI_PATH = /opt/openmpi/lib
MPI_LIB = /opt/openmpi/lib