WebMO Home Page
Features
Pro Features
Enterprise Features
Compare Features
System Requirements
Screen Shots
Working Demo
Support
Support Forum
Testimonials
Revision History
Mailing List
Curriculum Examples
Workshops
License Info
Pricing
Buy WebMO Pro/Ent
Obtain Free License
Download
|
|
|
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
#! /bin/csh
setenv INSTALL /usr/local
curl "http://netlib.sandia.gov/cgi-bin/netlib/netlibfiles.tar?filename=netlib/f2c" -o "f2c.tar"
tar -xvf f2c.tar
gunzip -rf f2c/*
cd f2c
mkdir libf2c
mv libf2c.zip libf2c
cd libf2c
unzip libf2c.zip
cp makefile.u Makefile
make
cp f2c.h $INSTALL/include
cp libf2c.a $INSTALL/lib
cd ../src
cp makefile.u Makefile
make
cp f2c $INSTALL/bin
cd ..
mkdir -p $INSTALL/man/man1
cp f2c.1t $INSTALL/man/man1
cp fc $INSTALL/bin/f77
chmod +x $INSTALL/bin/f77
cd ..
rm -rf f2c
echo "==================SUMMARY=================="
echo $0 " has built and installed:"
find $INSTALL -name '*f2c*' -mmin -5
find $INSTALL -name '*f77*' -mmin -5
- Run installation script
# chmod +x install_f2c_linux.csh
# ./install_f2c_linux.csh
which will produce the following files:
/usr/local/bin/f2c
/usr/local/include/f2c.h
/usr/local/lib/libf2c.a
/usr/local/man/man1/f2c.1t
/usr/local/bin/f77
- Translate, compile, link, and run a program
$ f2c hello.f
$ gcc -c hello.c
$ gcc -o hello hello.o -lf2c -lm
$ ./hello
Or combine these into a single command
Copyright © 2008, WebMO, LLC, all rights reserved.
|