gfortran.org

gfortran

gfortran

gfortran is the gpl fortran compiler which is part of gcc.

gfortran is available on almost all linux distributions. Unless you are needing a bug fix between releases, this is the best way to get gfortran.

yum install gcc-gfortran

This site provides regular builds of gfortran for those interested. For help withe downloading or installing gfortran from this site, please contect bdavis@gcc.gnu.org . For help with gfortran, go to gcc home page . The fortran mailing list is the place to go with questions or problems.

gfortran daily builds

g77

If for some reason you do not want to use gfortran to compile your fortran code, there is still g77. g77 was an excellent fortran-77 compiler that was part of gcc prior to gcc version 4.0. g77 had (and still does have) a reputation for being able to accept almost any fortran variant ever created. g77 binaries are still avaliable. as is the source, since gcc/g77 is licensed under the gpl.

Fedora Users

Running Fedora Linux ? g77 is easily available by:
yum install compat-gcc-34-g77

Build It Yourself


The last release in the gcc3.4 series (3.4.6) was on March 6th, 2006.

Can you still build g77 from source code ?
Let's give it a try:

(USE THE BASH SHELL FOR BEST RESULTS !!!!)

Also, read this whole page before you start !


wget http://gcc-uk.internet.bs/releases/gcc-3.4.6/gcc-3.4.6.tar.gz
tar xvzf gcc-3.4.6.tar.gz 
mkdir bin
mkdir run
cd bin
../gcc-3.4.6/configure --enable-languages=c,f77 --disable-checking --prefix=/home/bdavis/g77/run
make CC=/usr/bin/gcc
make install

bdavis@bdavis-desktop:~/g77$ cat a.f
      print*,'hello'
      end
bdavis@bdavis-desktop:~/g77$ /home/bdavis/g77/run/bin/g77 -static a.f
bdavis@bdavis-desktop:~/g77$ ./a.out
 hello


So, it looks like if you really want g77, you can make it yourself 2
years later.

UPDATE 06/01/2010.  Still works.  If you want g77, you can get it.

UPDATE 08/03/2010. A report from a Ubuntu linux user reports that the
above no longer works.

Here is a patchfile:

diff --recursive --context gcc-3.4.6/gcc/collect2.c /home/bdavis/g77_2/gcc-3.4.6/gcc/collect2.c
*** gcc-3.4.6/gcc/collect2.c	2005-01-10 09:25:23.000000000 -0600
--- /home/bdavis/g77_2/gcc-3.4.6/gcc/collect2.c	2010-09-03 16:44:38.104761159 -0500
***************
*** 1534,1540 ****
    if (redir)
      {
        /* Open response file.  */
!       redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT);
  
        /* Duplicate the stdout and stderr file handles
  	 so they can be restored later.  */
--- 1534,1540 ----
    if (redir)
      {
        /* Open response file.  */
!       redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT,S_IRWXU);
  
        /* Duplicate the stdout and stderr file handles
  	 so they can be restored later.  */


Put this in a file in your g77 directory (probably ~/g77 if you followed the above
directions.  I stored it in a file named 'pfile'. Also note I am using my home directory,
which is /home/bdavis.  You will need to change the instructions to reflect where your home
directory is or where you want to build and install g77.

cd
mkdir g77
cd g77
wget http://gcc-uk.internet.bs/releases/gcc-3.4.6/gcc-3.4.6.tar.gz
# get the patchfile in this directory, like a cut and paste into vi
vi pfile
mkdir bin
mkdir run
gunzip gcc-3.4.6.tar
tar xf gcc-3.4.6.tar 
patch -p0  < pfile 
cd bin
../gcc-3.4.6/configure --enable-languages=c,f77  \
--prefix=/home/bdavis/g77/run \
--disable-checking
make
make install



g77 will be in /home/bdavis/g77/run/bin

UPDATE 02/12/2010 from Jean-Claude Arbaut

> I noticed a problem on amd64 (debian or linux), when 32 bit libraries are not > installed : the build fails at some point, because of some -m32 during > compilation. If I understand the help, it's because gcc builds by default > compilers for both i386 and amd64. The build completes if I add the option > "--disable-multilib".

Comments or questions ? bdavis@gcc.gnu.org