I have to compile Fortran programs but I haven't managed to do it.
I'm not an experienced person in this topic but I've tried to make some changes in the makefile, unfortunately the problem persists.
The original makefile was:
CC = cc
F77 = f77
CFLAGS = -g -DSOLARIS -DDEBUG #-DINTEL -DFREEBSD #-DDEBUG
FFLAGS = -g -c
OBJDIR= ../bin
LIB = ./sub/libsaito.a
all: shearSAITOniu shearsaito.li shearsaito shearsaito.2 \
# shearsaito run.saito saito
shearSAITOniu: shearSAITOniu.f ${LIB}
f77 shearSAITOniu.f -e -o ${OBJDIR}/shearSAITOniu -g ${LIB}
shearsaito.li: shearsaito.li.f ${LIB}
f77 shearsaito.li.f -e -o ${OBJDIR}/shearsaito.li -g ${LIB}
shearsaito: shearsaito.f ${LIB}
f77 shearsaito.f -e -o ${OBJDIR}/shearsaito ${LIB}
shearsaito.2: shearsaito.2.f ${LIB}
f77 shearsaito.2.f -e -o ../bin/shearsaito.2 -g ${LIB}
qsaito.li: qsaito.li.f ${LIB}
f77 qsaito.li.f -e -o ${OBJDIR}/qsaito.li ${LIB}
forward: forward.f ${LIB}
f77 forward.f -e -o ${OBJDIR}/forward ${LIB}
#shear3d: shear3d.f ${LIB}
f77 shear3d.f -e -o shear3d ${LIB}
#run.saito: run.saito.f ${LIB}
f77 run.saito.f -o run.saito ${LIB}
#s_saito: s_saito.f ${LIB}
# f77 s_saito.f -o s_saito ${LIB}
Then I made a change in CCFLAGS replacing -DSOLARIS with -D_LINUX.
After doing make it appears the error message:
f77 shearSAITOniu.f -e -o ../bin/shearSAITOniu -g ./sub/libsaito.a
/usr/bin/f77: Illegal option: -e
make: *** [shearSAITOniu] Error 255
I'm not sure about the meaning of this error message but I also tried to replace the f77 compiler with gfortran and get this error:
gfortran shearSAITOniu.f -e -o ./shearSAITOniu -g ./sub/libsaito.a
gfortran: error: ./shearSAITOniu: No existe el archivo o el directorio
make: *** [shearSAITOniu] Error 1
I think that this programs were compiled originaly in a 32-bit machine, mine is 64-bit, but I don't know how exactly this affects. I hope you could help me solving this issue, thanks.
To compile the program shearSAITOniu
with gfortran
, use the commandline:
gfortran shearSAITOniu.f -ffree-form -o ./shearSAITOniu -g ./sub/libsaito.a
This will solve the error:
gfortran: error: ./shearSAITOniu: No existe el archivo o el directorio
but not necessarily other errors you have not yet discovered.
This is the reason for that error:
-e
is an option of the f77
compiler that means: Accept extended length input source lines .
-o
filename is an option of both the f77
and gfortran
compilers that means: Create output file "filename" .
-e
symbol is an option of the gfortran
compiler (strictly, the linker) that means: Make symbol "symbol" the entry point of the program .
For both the f77
and the gfortran
compilers a filename that appears on the commandline that is not preceded by the option -o
is interpreted as naming an input file for compiling or linking.
Therefore what the failing commandline:
gfortran shearSAITOniu.f -e -o ./shearSAITOniu -g ./sub/libsaito.a
means to gfortran
is: Compile and link the input files shearSAITOniu.f
, ./shearSAITOniu
and ./sub/libsaito.a
; insert debugging information in the resulting program ( -g
), and make symbol -o
the entry point of the program.
The -o
is interpreted as the symbol of the option -e
symbol , and ./shearSAITOniu
is interpreted as an input file, which does not exist.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.