Hello, friends. In this post, you will learn how to install GNU Fortran on Fedora 34. This programming language may seem forgotten by many but it is still important for others.
GNU Fortran is a Fortran 95/003/2008 compiler created by GNU. It is also known on the Internet as GFortran. It is open-source, released under the GPL license. To create a modern compiler capable of running on multiple systems and multiple environments.
At the time of writing this post, the latest stable release of this compiler is 11. This branch incorporates a lot of new features and bug fixes.
If you don’t know, Fortran is a numerical computing language, originally designed for IBM computers and used in scientific and engineering applications and is the oldest of the high-level languages.
So let’s install and test it on Fedora 34.
Install GNU Fortran on Fedora 34
Fortunately, GNU Fortran is available in the official Fedora 34 repositories. So the quickest way to do the installation is to open a terminal and first update the system.
sudo dnf update
Now yes, you can install it by running the following command
sudo dnf install gcc-gfortran
After that, you can check the installed version by running the following command
gfortran --version
Sample output
GNU Fortran (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3) 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.
With this, it is installed.
Testing the installation on Fedora 34
The compiler is installed, but to make sure it is working correctly, we need to test it.
So, create a fortran file and add some code.
nano hello.f90
Note: I’m using nano
as a text editor. You can install it using dnf
or use whatever you prefer
And add this simple code that prints out a message
program hello write(6,*)'Hello world. Welcome to osradar.' stop end
Save your changes and close the editor.
Now compile it
gfortran -o hello hello.f90
And run it
./hello Hello world! Welcome to Osradar
So, GNU Fortran is correctly installed on Fedora 34.
Conclusion
Fortran is a very old programming language. However, there are sectors where it is very important and that is why there are still tools for the language. In this case, we have Fortran and the GNU Fortran compiler.