tags:

views:

2628

answers:

5

I need a compiler for Fortran 77 in linux.

Are there any free compilers out there that people use?

I've heard about g77, but I can't find the rpm or how to install it in linux.

Thanks!

A: 

The means for getting software installed is distribution-specific. For example, in Ubuntu9, I would kick up Synaptic and do a search for Fortran or g77 (apt-get can also be used).

The other distributions I know little about although I've heard of yum and yast for (I think but I'm not sure) RedHat and Suse.

If it's not available through your standard package installer, you'll have to find another solution, such as:

  • using a different Fortran; or
  • building it from the source.

That second method sounds ominous but it's really not (other than ensuring you have the right dependencies). The configure/make/install process that most source packages follow makes it remarkably easy to do in a cross-distribution manner.

Some RPMs can be found here. The GNU software is available here or you may want to check out their mirrors for a faster site.

paxdiablo
+7  A: 

GCC's Fortran compiler name has changed: g77 has been replaced by gfortran, which handles Fortran 95 and possibly more recent variants.

The package in Ubuntu is called gfortran:

sudo apt-get install gfortran

(or use synaptic)

The package in Fedora is called gfortran and is part of gcc, which you probably already have:

sudo yum install gcc

(or use pirut)

Similar searches should work for your distribution as well.

Update: On RedHat 4.1.2 the package seems to be called gcc4-gfortran. Incidentally, you ought to be able to search for this with yum, and that may be the best answer to your question:

yum search "*fortran*"
quark
i have redhat. i tried "sudo yum install g77" and also gfortran but it says no package g77/gfortran available. am i doing it wrong?
chris
It's not called g77 for one thing. I did a Google search for "Redhat 4.1.2 gfortran". The package is apparently called "gcc4-gfortran". Updating the answer.
quark
+1  A: 

There's http://www.g95.org/ that's available.

If I remember well GNU doesn't have a FORTRAN compiler but a FORTRAN preprocessor (or whatever the name for that is). It just translates your code to C and the compiles it with the C compiler. Of course performance becomes crap in the process.

However if you're using FORTRAN I assume it's a kind of computation project. If it's for free (not academic and not course related) you can get Intel FORTRAN compiler for free. In my experience it goes about 3-4 times faster than any free implementation.

R4cOON
where can i get the *Free* copy of intel fortran for linux? I am having difficulty finding the free version on google.
chris
I think he might be referring to the free 30 day evaluation license.
Stephen C
http://software.intel.com/en-us/articles/non-commercial-software-development/
Stobor
Also, gfortran is a full compiler: http://gcc.gnu.org/wiki/GFortran
Stobor
If you're doing non-commercial development, the Intel compiler is a great deal.
Tim Whitcomb
+1  A: 

You can also use Netbeans and make c&c++ project and make add Fortran with new .f90 file and use Netbeans tools to run and debug . before that you must install gcc and gfortran packages .

SjB
A: 

In my experience, Red Hat distributions (and those based on it) have gfortran included, but it is an option when you do the installation, so it seems probable that your system was set up without gfortran. If you have installation media, I think you should be able to install gfortran from there.

Otherwise, to get the proper gfortran RPM for your system, I suggest the related rpmfind page.

Once you get gfortran installed, I think the "-std=legacy" (quotes mine) should allow an F77 compile to work.

PTBNL