How to Install GNU Fortran on Fedora

While it is true that there are many modern programming languages, FORTRAN is still used by many users around the world. That’s why we’ve prepared this tutorial so that you can learn how to install GNU FORTRAN on Fedora 35 and have an excellent compiler for this language.

What is FORTRAN?

The legendary FORTRAN is a programming language used in mathematics and scientific computing applications. So, although its user base may be minimal, it has a large utility for the calculations and uses it can be put to.

We say it is legendary because it was originally developed by IBM in 1957 and used for scientific and engineering applications. So, it is an experienced and very stable language that over time has gained modern features such as object-orientation.

As you can see, FORTRAN is not widely used outside the fields of computer science and numerical analysis. Nevertheless, it remains the language of choice for high-performance numerical computing tasks.

This evolution has been accompanied by compilers that support FORTRAN. One of them is GNU FORTRAN.

This compiler, which is part of GNU, is open source, so we can install it without any problems. It provides support for FORTRAN 95 but has evolved to provide features of FORTRAN 2003.

So, this is the compiler that we are going to install on fedora 35.

Install GNU FORTRAN on Fedora 35

Let’s get started. First open a terminal and refresh the entire operating system.

sudo dnf update

After the system already has the security patches installed, you can start with the installation. Specifically, we have to run the following command.

sudo dnf install gcc-gfortran
Install GNU Fortran on Fedora
Install GNU Fortran on Fedora

After the installation is finished, you can check the version you have just installed with the command

gfortran --version
Fortran Version
Fortran Version

You will get an output screen similar to this one

GNU Fortran (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Then we will have GNU FORTRAN on the system. Now let’s test it.

Create a new application with GNU FORTRAN

The best way to test if everything is working, it is creating a new application and run it.

So, first create a new file with extension .f90.

nano hello.f90

Then, add some FORTRAN code as a kind of Hello World.

program hello
write(6,*)'Hi from Atechtown.com Welcome.'
stop
end
New Fortran App
New Fortran App

Save your changes and close the editor.

Compile the above file as follows

gfortran -o hello hello.f90

This will generate an executable binary called hello which you will need to run

./hello

You will get an output screen like this

Hi from Atechtown.com Welcome.
Fortran running
Fortran running

This indicates that GNU FORTRAN is installed correctly.

Uninstall GNU FORTRAN on Fedora 35

If you no longer want to use FORTRAN, it is best to remove it from the system to save space.

To achieve this, you have to run

sudo dnf remove gcc-gfortran

This will remove all GNU FORTRAN from Fedora.

Conclusion

FORTRAN is an old language, but it is still used in important numerical computation situations and so on. So if you are a professional in this branch or an enthusiast, you should know how to install it as we have explained today.

I hope you found this post useful and help us to grow by sharing it with your friends.

Share This:

Leave a Comment

Your email address will not be published. Required fields are marked *