Child pages
  • Build GCC with Fortran as gFortran
Skip to end of metadata
Go to start of metadata

Lincoln Tran updated May 1, 2012 at 2:03 PM


  1. Make a directory ~/build
  2. Make a directory /opt/igpp if it does not yet exist as well as /opt/igpp/bin
  3. Download the source code for GCC (gcc-x.x.x.tar.gz) and put it into ~/build. The other with individual languages like gcc-fortran or gcc-core are unnecessary since the main tar file contains all of the languages (it's ~60MB).
  4. Download GMP, MPFR, and MPC from GNU and put their tar files into ~/build as well. 
  5. Untar each one. You can delete the tar files at this point.

Make note that x.x.x (and y.y.y, etc) is the version number in this documentation. It may be only x.x. Replace x.x.x in the following instructions with the version number you downloaded.

Also note $ is the notation of a command in a shell. Do not type it.

We are installing GCC into /opt/igpp/bin as gfortran. You can rename it to gcc-n.n.n or another name if you wish by replacing the BOLD 'gfortran' with the names you wish.

Installing GMP, MPFR, and MPC


  • Enter the directory for GMP that you untarred.

    $ cd gmp-x.x.x
  • Run the following: 

    $ ./configure --prefix=/opt/igpp/gmp-x.x.x --enable-cxx $ nice -n 19 time make -j8 $ make install 


  • Enter the directory for MPFR that you untarred. 

    $ cd ~/build/mpfr-y.y.y 
  • Run the following: 

    $ ./configure --prefix=/opt/igpp/mpfr-y.y.y --with-gmp=/opt/igpp/gmp-x.x.x $ nice -n 19 time make -j8 $ make install


  • Enter the directory for MPC you untarred. 

    $ cd ~/build/mpc-z.z.z
  • Run the following: 

    $ LD_LIBRARY_PATH=/opt/igpp/gmp-x.x.x/lib:/opt/igpp/mpfr-y.y.y/lib ./configure --prefix=/opt/igpp/mpc-z.z.z --with-gmp=/opt/igpp/gmp-x.x.x --with-mpfr=/opt/igpp/mpfr-y.y.y $ LD_LIBRARY_PATH=/opt/igpp/gmp-x.x.x/lib:/opt/igpp/mpfr-y.y.y/lib nice -n 19 time make -j8 $ make install

Building GCC

  • Run the following: 

    $ cd ~/build/gcc-n.n.n 
    $ LD_LIBRARY_PATH=/opt/igpp/gmp-x.x.x/lib:/opt/igpp/mpfr-y.y.y/lib:/opt/igpp/mpc-z.z.z/lib ./configure --prefix=/opt/igpp/gfortran --with-gmp=/opt/igpp/gmp-x.x.x --with-mpfr=/opt/igpp/mpfr-y.y.y --with-mpc=/opt/igpp/mpc-z.z.z --enable-languages=c,fortran --program-transform-name=gfortran --bindir=/opt/igpp/bin 
    $LD_LIBRARY_PATH=/opt/igpp/gmp-x.x.x/lib:/opt/igpp/mpfr-y.y.y/lib:/opt/igpp/mpc-z.z.z/lib nice -n 19 time make -j8 $ make install
  • No labels