How to install gfortran-7 on Ubuntu 22.04?

I have a code written in FORTRAN 77 that only runs with gfortran 7. I was able to install gfortran 7 on my old computer under Ubuntu 20.04 with sudo apt install gfortran-7. Now I have a new computer under Ubuntu 22.04 and this command does not work anymore : E: Unable to locate package gfortran-7.

Is there a way to install gfortran-7 on Ubuntu 22.04 ?

4

2 Answers

If you need for some reason that specific version which is no longer supported since Nov. 2019, you can try to build it from sources following the instructions on this page:

Otherwise, you should install one of the versions available in the official repositories of Ubuntu 22.04:

  • gfortran-9 (9.4.0)
  • gfortran-10 (10.3.0)
  • gfortran-11 (11.2.0)
  • gfortran-12 (12.1.0)

By default, gfortran stands for gfortran-11:

$ sudo apt install gfortran 

Installing gfortran-12 may be interesting if there are new features that you need, or if it increases performances. Installing an older version may be interesting because they may have less bugs: 9.4.0 will have less bugs than the fresh 12.1.0. In fact, concerning performances, it depends on your code. You may install the four versions and benchmark them with your programs. A newer version may be faster... or not...

Note that the release year of those four versions can be obtained by adding 10 to the major version: gfortran-9 was initially released in 2019 and gfortran-12 in 2022.

3

You can install older versions of gfortran (eg., gfortran-7 or higher) in Zorin Linux. The zorin package repository contains older gfortran versions. So install zorin linux and install gfortran as "sudo apt install gfortran-7". Latest ubuntu does not contain gfortran-7 but zorin, which uses ubuntu packages, contains gfortran-7. I dont know why.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like