Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28996 Discussions

linking with ifort generated library on Leopard

gyiornl_gov
Beginner
438 Views
Dear all,

I could compile my code with ifort11.1 on Linux and created a library successfully. Now I can link my other programs with the library on Linux. i was trying to perform the same task on Leopard with the same version of ifort. I could compile the code and create libs on Leopard but can not link!!!

f90 flags to create the lib:
F90FLAGS =-i-static -assume nounderscore -g -c
ar r libmy.o *.o

ifort-i-static -assume nounderscore -g -c external.f90

ifort -o external external.o -L. -lmy

then i got:

Undefined symbols:
"_comp", referenced from:
_MAIN__ in external.o
ld: symbol(s) not found

note: comp is in the library called 'libmy.a' in the same folder.

As you can see above, nounderscore option is used and still getting this error. I could compile and link on Linux with ifort11.1 with no problem but not on Leopard!! Am i missing a compiler option or an additional system lib to link?

Any ideas?

croc

0 Kudos
2 Replies
TimP
Honored Contributor III
438 Views
Among the possibilities might be that you may have built one object with 32-bit compiler and another with 64-bit. Of course, it would be preferable if you could avoid nounderscore, which you would have to use consistently.
0 Kudos
Kevin_D_Intel
Employee
438 Views

This isn't reproducible with a trivial test case.

As Tim suggested, double check that the source file containing the missing routine comp was compiled with -assume nounderscore if that's what you need/desire and verify the compilation of that source file actually succeeded.

Also verify the routine is present in the static archive.

A shot in the dark, maybe try running ranlib on your static archive after all .o files have been added.

Just FYI, -i-static is missed on the final link and that form isdeprecated. The new form is -static-intel which is the default anyway.
0 Kudos
Reply