The Humble Fortran Programmer

yum install gcc-gfortran

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 (use BASH preferrably):
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/sma/g77/run
make CC=/usr/bin/gcc
make install

spoofmyarp@sma:~/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

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

Anuncios