I have legacy fortran 77 code that used to compile seamlessly using g77 on an old machine. I've tried to recompile it on a new machine (old one is dead) using the original makefile, but the linker fails under g77, while there are persisting syntax errors using gfortran.
I have two source files readmixed.f and subroutines.f.
Under g77 the object files are produced using
Quote:
$ f77 -c readmixed.f -o readmixed.o
$ f77 -c subroutines.f -o subroutines.o
|
but the linking fails with
Quote:
$ f77 readmixed.o subroutines.o -o readmixed
subroutines.o(.text+0x0): In function `norm1_':
: multiple definition of `norm1_'
readmixed.o(.text+0x3987): first defined here
subroutines.o(.text+0x59): In function `cross_':
: multiple definition of `cross_'
readmixed.o(.text+0x39e0): first defined here
subroutines.o(.text+0xb9): In function `xparse_':
: multiple definition of `xparse_'
---------------- snip ----------------
and many similar messages, for each subroutine ...
|
With gfortran, I don't get through the compile. The user guide suggests a couple of options that might be useful:
Quote:
-ff2c -- for f77 code
-std=legacy -- (seems to be the best of the options)
-fPIC -- a gcc option, which I recall once seeing in a posting about x86_64 options
|
While I think that the -ff2c is likely the option that matters (most), for all permutations of these parameters, I get errors like
Quote:
readmixed.f:14.16:
real*4 bx(sz0), by(sz0), bz(sz0), ex(sz0), ey(sz0), ez(sz0)
1
Error: Expression at (1) must be of INTEGER type, found REAL
readmixed.f:14.20:.
.
.
readmixed.f:2062.14:
integer i
1
Warning: Nonconforming tab character at (1)
readmixed.f:2063.16:
character st*(*)
1
Warning: Nonconforming tab character at (1)
|
These seem to suggest that the complaint is with f77 declarations in general, as if the -ff2c option were not included (but it was).
The gfortran is part of a standard gcc install with Fedora 11:
Quote:
gfortran --version
GNU Fortran (GCC) 4.4.1 20090725 (Red Hat 4.4.1-2)
Copyright (C) 2009 Free Software Foundation, Inc.
|
while I obtained the f77 compiler from yum:
Quote:
# yum -y install compat-gcc-34-g77-3.4.6-13.x86_64.
.
.
Installed:
compat-gcc-34-g77.x86_64 0:3.4.6-13
Dependency Installed:
compat-gcc-34.x86_64 0:3.4.6-13 compat-libf2c-34.x86_64 0:3.4.6-13
|
As the rpms suggest, I'm using Intel x86_64 hardware:
Quote:
$ uname -a
Linux xxx.xxx.edu 2.6.30.9-96.fc11.x86_64 #1 SMP Wed Nov 4 00:02:04 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
|
Any suggestions for what flags to supply to either version would be appreciated!