Install latest GFortran 10 on Linux

Newer version of compilers generally have more useful and detailed warning messages. Recent GCC versions have been steadily improving Fortran 2018 support. As with any compiler, newer versions of Gfortran may require rebuilding other libraries linked with the Fortran compiler if the ABI presented by libgfortran changes. On Linux, one can switch Gfortran versions with update-alternatives. If experiencing errors getting any version of gfortran installed in Ubuntu, try:

add-apt-repository universe

Ubuntu PPA

The latest GCC / Gfortran for Ubuntu is available from the Ubuntu-test PPA. Add Ubuntu-test PPA by:

add-apt-repository ppa:ubuntu-toolchain-r/test

apt update

Install the most recent Gfortran (similarly for gcc-10, g++-10) by:

apt install gfortran-10

Switch between compiler versions with update-alternatives.

  • Windows: Install latest Gfortran
  • MacOS: get latest gfortran by brew install gcc