Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

ifort and old fortran code

robb_99
Beginner
565 Views
I am trying to compile an ANSI compatible FORTRAN program that was written in '98 and link it with two additional object files that were compiled with the f77 compiler provided with RH Linux 5.1. I am new to Linux and have exhausted all imaginable options. I can compile fine with the -c option however, I cannot link the program. I get the following errors when I execute :

ifort -o dataonlyb dataonlyb.o ../gasp_v33b.o ../prng_v33.o

dataonlyb.o(.text+0x34): In function `MAIN__':
: undefined reference to `f_open'
dataonlyb.o(.text+0x4c): In function `MAIN__':
: undefined reference to `f_open'
dataonlyb.o(.text+0xc1): In function `MAIN__':
: undefined reference to `s_wsfe'
dataonlyb.o(.text+0xdf): In function `MAIN__':
: undefined reference to `do_fio'
dataonlyb.o(.text+0xfd): In function `MAIN__':
: undefined reference to `do_fio'
dataonlyb.o(.text+0x11b): In function `MAIN__':
: undefined reference to `do_fio'
dataonlyb.o(.text+0x139): In function `MAIN__':
: undefined reference to `do_fio'
dataonlyb.o(.text+0x157): In function `MAIN__':
: undefined reference to `do_fio'
dataonlyb.o(.text+0x172): more undefined references to `do_fio' follow
dataonlyb.o(.text+0x1f1): In function `MAIN__':
: undefined reference to `e_wsfe'

etc.. etc... for the additional two object files I am trying to link with...

I do not have access to the source files for the two linked object files, is there a way to do this using ifort without?

Thanks for your help and time in advance.
0 Kudos
2 Replies
Intel_C_Intel
Employee
565 Views
Those symbols are from the GNU fortran runtime system. Your code
may build if you force ifort to look through libg2c (the current
location for the GNU fortran I/O stuff). However there may be
some library version problems.

You can try

ifort -o dataonlyb dataonlyb.o ../gasp_v33b.o ../prng_v33.o
/usr/lib/libg2c.so.0

If that library is not found, try "locate libg2c" for alternatives.

For the record, does anyone else know whether there are restrictions
on combining libg2c with the Intel Fortran libraries? I have
not seen problems with a few simple cases, but expect there are
traps here.
0 Kudos
Steven_L_Intel1
Employee
565 Views
We don't claim link compatibility of ifort with code compiled with other Fortran compilers. If you can get the libraries to resolve, maybe it will work, maybe it won't.
0 Kudos
Reply