Fortran Compiler Installation Instructions for OS X

1

I try install fortran compiler for Mac OSX El captain. Firstly;

I install install_f2c_osx.csh Run installation script $ chmod +x install_f2c_osx.csh $ sudo ./install_f2c_osx.csh

It gives this warning:

1 warning generated.
ld -r -x -o wsne.xxx wsne.o
mv wsne.xxx wsne.o
cc -c -DSkip_f2c_Undefs -O xwsne.c
ld -r -x -o xwsne.xxx xwsne.o
mv xwsne.xxx xwsne.o
cc -c -DSkip_f2c_Undefs -O dtime_.c
ld -r -x -o dtime_.xxx dtime_.o
mv dtime_.xxx dtime_.o
cc -c -DSkip_f2c_Undefs -O etime_.c
ld -r -x -o etime_.xxx etime_.o
mv etime_.xxx etime_.o
ar r libf2c.a f77vers.o i77vers.o main.o s_rnge.o abort_.o exit_.o getarg_.o iargc_.o getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o ctype.o derf_.o derfc_.o erf_.o erfc_.o sig_die.o uninit.o pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o pow_ri.o pow_zi.o pow_zz.o c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o z_abs.o z_cos.o z_div.o z_exp.o z_log.o z_sin.o z_sqrt.o r_abs.o r_acos.o r_asin.o r_atan.o r_atn2.o r_cnjg.o r_cos.o r_cosh.o r_dim.o r_exp.o r_imag.o r_int.o r_lg10.o r_log.o r_mod.o r_nint.o r_sign.o r_sin.o r_sinh.o r_sqrt.o r_tan.o r_tanh.o d_abs.o d_acos.o d_asin.o d_atan.o d_atn2.o d_cnjg.o d_cos.o d_cosh.o d_dim.o d_exp.o d_imag.o d_int.o d_lg10.o d_log.o d_mod.o d_nint.o d_prod.o d_sign.o d_sin.o d_sinh.o d_sqrt.o d_tan.o d_tanh.o i_abs.o i_dim.o i_dnnt.o i_indx.o i_len.o i_mod.o i_nint.o i_sign.o lbitbits.o lbitshft.o h_abs.o h_dim.o h_dnnt.o h_indx.o h_len.o h_mod.o h_nint.o h_sign.o l_ge.o l_gt.o l_le.o l_lt.o hl_ge.o hl_gt.o hl_le.o hl_lt.o ef1asc_.o ef1cmc_.o f77_aloc.o s_cat.o s_cmp.o s_copy.o backspac.o close.o dfe.o dolio.o due.o endfile.o err.o fmt.o fmtlib.o ftell_.o iio.o ilnw.o inquire.o lread.o lwrite.o open.o rdfmt.o rewind.o rsfe.o rsli.o rsne.o sfe.o sue.o typesize.o uio.o util.o wref.o wrtfmt.o wsfe.o wsle.o wsne.o xwsne.o dtime_.o etime_.o
ar: creating archive libf2c.a
ranlib libf2c.a
./xsum Notice README cds.c data.c defines.h defs.h equiv.c error.c exec.c expr.c f2c.1 f2c.1t f2c.h format.c format.h formatdata.c ftypes.h gram.c gram.dcl gram.exec gram.expr gram.head gram.io init.c intr.c io.c iob.h lex.c machdefs.h main.c makefile.u makefile.vc malloc.c mem.c memset.c misc.c names.c names.h niceprintf.c niceprintf.h output.c output.h p1defs.h p1output.c parse.h parse_args.c pccdefs.h pread.c proc.c put.c putpcc.c sysdep.c sysdep.h sysdeptest.c tokens usignal.h vax.c version.c xsum.c >xsum1.out
/bin/sh: ./xsum: Permission denied
make: *** [xsum.out] Error 126
cp: f2c: No such file or directory

What advice do you to solve the problem? Thank you

user608755

Posted 2016-06-21T18:22:28.943

Reputation: 11

Answers

0

You need to remove src/xsum, an executable for the wrong architecture. The Makefile will automatically build it again.

I found this by stepping through install_f2c_osx.csh manually.

In the src subdirectory make produced:

make ./xsum Notice README cds.c data.c defines.h defs.h equiv.c error.c exec.c expr.c f2c.1 f2c.1t f2c.h format.c format.h formatdata.c ftypes.h gram.c gram.dcl gram.exec gram.expr gram.head gram.io init.c intr.c io.c iob.h lex.c machdefs.h main.c makefile.u makefile.vc malloc.c mem.c memset.c misc.c names.c names.h niceprintf.c niceprintf.h output.c output.h p1defs.h p1output.c parse.h parse_args.c pccdefs.h pread.c proc.c put.c putpcc.c sysdep.c sysdep.h sysdeptest.c tokens usignal.h vax.c version.c xsum.c >xsum1.out
/bin/sh: ./xsum: Permission denied
make: *** [xsum.out] Error 126

That allowed f2c to complete building.

See Fortran Compiler Installation Instructions for OS X The section f2c TRANSLATOR / f77 COMPILER

Step 3:

  1. Translate, compile, link, and run a program

$ f2c hello.f
$ gcc -c hello.c
$ gcc -o hello hello.o -lf2c -lm
$ ./hello

failed in the first step producing:

src/f2c hello.f
hello.f:
Error on line 1 of hello.f: illegal continuation card (starts "progra")
Error on line 2 of hello.f: nondigit in statement label field "print"
Error on line 3 of hello.f: labeled continuation line (starts "end pr")
Error on line 2 of hello.f: unclassifiable statement (starts "*,")

There were numerous warnings building in the src subdirectory as a small number building libf2c.a. A good first step to getting this somewhat dated code working might be to eliminate the warnings (which are self explanatory).

user187561

Posted 2016-06-21T18:22:28.943

Reputation: 633