I am trying to run some of old legacy fortran code of my team.
- I have two Fortran 77 codes (
cklib.f
andgrcom.f
) which I compile using fort77 and got two object files. - And I have two Fortran 90 codes (
write_counterflow_sol.f
andread_counterflow_sol.f
) which I compile using gfortran and got another two object files.
Now, using a following makefile, I am trying to create an executable called remail.e
SOURCE_CHEMKIN = ../CHEMKIN/DATA_BASES/SOURCES
SOURCE_APPLI= ../SOURCES_COUNTERFLOW/
SOURCES_f77 = $(SOURCE_CHEMKIN)cklib.f $(SOURCE_APPLI)grcom.f $(SOURCE_APPLI)write_counterflow_sol.f $(SOURCE_APPLI)read_counterflow_sol.f
TARGET = remail.e
OBJECTS = $(SOURCES_f77:.f=.o)
COMPILE = f90
.f90.o :
$(COMPILE) -o $*.o -c $*.f90
.f.o :
$(COMPILE) -o $*.o -c $*.f
$(TARGET) : $(OBJECTS)
$(COMPILE) $(OBJECTS) -o $@
del :
$(DELETE) $(OBJECTS)
but end up with the following error,
make: f90: Command not found
make: *** [remail.e] Error 127
I know there is no f90 compiler in my system, so I tried with COMPILE=gfortran
instead of COMPILE=f90
in the makefile and ended up with this error.
gfortran ../CHEMKIN/DATA_BASES/SOURCES/cklib.o ../SOURCES_COUNTERFLOW/grcom.o ../SOURCES_COUNTERFLOW/write_counterflow_sol.o ../SOURCES_COUNTERFLOW/read_counterflow_sol.o -o remail.e
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
../CHEMKIN/DATA_BASES/SOURCES/cklib.o: In function `ckcomp_':
fort77-27216-1.c:(.text+0x3a4a): undefined reference to `s_cmp'
../CHEMKIN/DATA_BASES/SOURCES/cklib.o: In function `ckcpml_':
fort77-27216-1.c:(.text+0x3eb8): undefined reference to `pow_di'
fort77-27216-1.c:(.text+0x476f): undefined reference to `s_wsle'
fort77-27216-1.c:(.text+0x4788): undefined reference to `do_lio'
fort77-27216-1.c:(.text+0x478d): undefined reference to `e_wsle'
../CHEMKIN/DATA_BASES/SOURCES/cklib.o: In function `ckrat_':
fort77-27216-1.c:(.text+0xfac0): undefined reference to `pow_dd'
fort77-27216-1.c:(.text+0xfb17): undefined reference to `pow_dd'
fort77-27216-1.c:(.text+0xfef5): undefined reference to `pow_di'
../SOURCES_COUNTERFLOW/grcom.o: In function `MAIN__':
fort77-27073-1.c:(.text+0x1d): undefined reference to `s_copy'
fort77-27073-1.c:(.text+0x36): undefined reference to `s_copy'
fort77-27073-1.c:(.text+0x13e): undefined reference to `s_wsle'
../SOURCES_COUNTERFLOW/write_counterflow_sol.o: In function `write_counterflow_sol__':
fort77-27083-1.c:(.text+0x85): undefined reference to `f_open'
fort77-27083-1.c:(.text+0xc0): undefined reference to `s_wsfe'
fort77-27083-1.c:(.text+0xd6): undefined reference to `do_fio'
../SOURCES_COUNTERFLOW/read_counterflow_sol.o: In function `read_counterflow_sol__':
fort77-28808-1.c:(.text+0x85): undefined reference to `f_open'
fort77-28808-1.c:(.text+0x9b): undefined reference to `s_rsfe'
fort77-28808-1.c:(.text+0xb1): undefined reference to `do_fio'
collect2: error: ld returned 1 exit status
make: *** [remail.e] Error 1
Also I tried with COMPILE=f77
in the makefile and successfully executed but when I run the executable I get this following error.
fmt: end of file
apparent state: unit 14 named sol2
last format: (3i10)
lately reading sequential formatted external IO
Aborted (core dumped)
The output of f77 -v
gives the following,
/usr/bin/f77: fort77 Version 1.15
/usr/bin/f77: No input files specified
The output of f77 --version
gives the following,
/usr/bin/f77: Illegal option: --version
The output of type f77
gives the following,
f77 is hashed (/usr/bin/f77)
Sorry for the long post. But any help is appreciated.