User compilers installation

November 19, 2015

Installation of GNU compilers

There are many ways to install GNU compilers. And the following is found to be the most simple and straightforward way. The following ingredients are the simplified version of here.

  1. First download and unpacked your desired version of gcc compiler. Here an official gcc download address are provided https://ftp.gnu.org/gnu/gcc . And we will take version 5.2.0 as an example. If other versions are desired, please replace 5.2.0 in all following instructions by the version number, e.g. replace gccver=5.2.0 by gccver=4.9.3.

    gccver=5.2.0
    mkdir ~/gcc-tmp
    cd ~/gcc-tmp
    wget https://ftp.gnu.org/gnu/gcc/gcc-${gccver}/gcc-${gccver}.tar.gz
    tar -xzf gcc-${gccver}.tar.gz 
    
  2. Download the prerequisite sources into the same gcc source directory.

    cd ~/gcc-tmp/gcc-${gccver}
    ./contrib/download_prerequisites
    
  3. Create a building directory and configure gcc. One important thing here is that the building directory must be different from the source directory.

    mkdir ~/gcc-tmp/build
    cd ~/gcc-tmp/build
    ~/gcc-tmp/gcc-${gccver}/configure --prefix=/path/to/install/the/gcc/ --disable-multilib
    
  4. Build gcc.

    cd ~/gcc-tmp/build
    make
    
  5. Install gcc.

    cd ~/gcc-tmp/build
    make install
    
  6. Clean all temporary folders and files.

    cd ~
    rm -rf ~/gcc-tmp 
    

Installation of MPICH

MPICH is a high performance and widely portable implementation of the Message Passing Interface (MPI) standard. The following ingredients are the simplified version of here.

  1. First download and unpacked your desired version of mpich. Here an official mpich download address are provided http://www.mpich.org/static/downloads/. And we will take version 3.2 as an example. If other versions are desired, please replace 3.2 in all following instructions by the version number, e.g. replace mpichver=3.2 by mpichver=3.1.4.

    mpichver=3.2
    mkdir ~/mpich-tmp
    cd ~/mpich-tmp
    wget http://www.mpich.org/static/downloads/${mpichver}/mpich-${mpichver}.tar.gz
    tar -xzf mpich-${mpichver}.tar.gz 
    
  2. Configure mpich.

    cd ~/mpich-tmp/mpich-${mpichver}
    LD_LIBRARY_PATH=/path/to/installed/gcc/lib64 ./configure CC=/path/to/installed/gcc/bin/gcc CXX=/path/to/installed/gcc/bin/g++ F77=/path/to/installed/gcc/bin/gfortran FC=/path/to/installed/gcc/bin/gfortran --prefix=/path/to/install/the/mpich/
    
  3. Install mpich.

    cd ~/mpich-tmp/mpich-${mpichver}
    make install
    
  4. Clean all temporary folders and files.

    cd ~
    rm -rf ~/mpich-tmp 
    

Updating List:

  1. 2015-11-19: Added the first version of the compilers installation instructions.

  2. 2015-11-20: Added the installation instructions for mpich.


Please let me know if any of other compilers are useful to be installed under local directory.

 

Yingzhou Li

Discussion

I'm a faculty at Fudan University. Follow me on Github and Bitbucket. Hopefully, you will find my code useful. You are also welcome to either email me or post comments below to discuss on these posts.