compiler error

compiler error

I'm trying to link some fortran object file compiled from ifc with some fortran libraries from someone else, and I got the following error:
ehrpt.o(.text+0x1c): undefined reference to `s_wsle'
ehrpt.o(.text+0x32): undefined reference to `do_lio'
ehrpt.o(.text+0x37): undefined reference to `e_wsle'
ehrpt.o(.text+0x5c): undefined reference to `s_wsle'
ehrpt.o(.text+0x72): undefined reference to `do_lio'
ehrpt.o(.text+0x77): undefined reference to `e_wsle'

I found some documentation from Intel mentioned this issue:
"
The next example illustrates the problem if I/O is performed in a subroutine compiled with different Fortran compilers. This causes the link to fail due to unresolved references, because the two compilers have different run-time libraries. This example illustrates one of many related errors that can result from mixing object files compiled with different Fortran compilers, and why this practice is not recommended.

$ cat example-io.F

SUBROUTINE FOO

END

SUBROUTINE FOO_BAR

print*,'in foo_bar'

END

$ ifc g77-ifc.F90

$ g77 -c example-io.F

$ ifc example-io.o g77-ifc.o

example-io.o: In function `foo_bar__':

example-io.o(.text+0x17): undefined reference to `s_wsle'

example-io.o(.text+0x30): undefined reference to `do_lio'

example-io.o(.text+0x38): undefined reference to `e_wsle'
"

Since I can't re-compile the library from others', is there any way to solve this problem?

Thanks.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

If you have decided to use the g77 run-time library, you must avoid any run-time library calls in the code you compile with ifc. Then, if you use g77 as the link command, it ought to work. As the documents you found point out, this approach is far from satisfactory.

ifc -c yourifcsource.f
g77 yourothersource.f yourifcsource.o theirlibrary

Leave a Comment

Please sign in to add a comment. Not a member? Join today