f2c / f77 Installation Instructions for Linux
f2c / f77 background
f2c is a fortran77-to-c source code translator. Because f2c is written in c and its ouput is c, both of which can be compiled natively on unix operating systems, f2c offers a very transportable compiler solution for compiling fortran programs. f2c also offers a means of converting large fortran libraries, such as LAPACK, into c. f2c is still actively maintained and is available at http://www.netlib.org/f2c/.
The original f77 program, which was written in c, was the first complete fortran77 compiler. The original f77 program is no longer available for current computer architectures. However, f2c is based on the original f77 program, and the f2c distribution contains a f77 wrapper script that combines the f2c translation and c compilation steps. The f77 script also supports many command line options commonly associated with fortran compilers. Since the f77 script calls f2c, which in turn is based upon the original f77 program, the f77 script within the f2c distribution represents the most current implementation of the original f77 program.
- Download installation script
Download install_f2c_linux.csh which is the following script
- Run installation script
# chmod +x install_f2c_linux.cshwhich will produce the following files:
- Translate, compile, link, and run a program
$ f2c hello.fOr combine these into a single command
$ gcc -c hello.c
$ gcc -o hello hello.o -lf2c -lm
$ f77 -o hello hello.f