fortran libraries to include in using gcc

fortran libraries to include in using gcc

Hi, list,
I've been developing an application for the open source program pd. This requires compiling different parts of code in both Fortran and C. I've been using gcc to compile and link everything...
The fortran code has been successfully compiled, linked, and tested using the intel fortran compiler, but I'm having difficulty making the transition to linking everything together with gcc.
The makefile compiles all of the fortran code into individual .o files, and then gcc tries to link them with the C code for the module. I found that when I link using -lifcore (includes libifcore.a) in gcc, I resolve the undefined symbol errors, but further errors remain when I try to run the code. Namely, the code produces a segmentation fault. I've been trying to debug using gdb, and I find that the error stems from a symbol for_open, and subsequent calls made by ifcore.
Should I be including other libraries from the intel fortran compiler as well?
(I'm running FC4 on an i386 arch).
Chuck Henry

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

In many situations, it's simpler to use ifort to drive the link, adding any libraries required by your gcc code. Usually, there are several libraries required by ifort. Ifort option -# would show details of the link command.

hmmm....so, could I compile my C code and link it with ifort?
On the other hand, I could find the libraries in the test code which is successful, using -#, and then, link them in with gcc...
I'll try gcc first, since there are many C libraries to link in as well, and then try ifort after that. I'll reply back later, once I get the results.

Ifort linking requirements are usually rather complex compared to gcc. Fortunately, you can use the -v flag to see all of the details. Remember that the way you link mixed C/Fortran code depends on what language the main entry procedure is in.

Im trying to do exactly the same thing - use gcc to link gcc C++ objects with Intel Fortran objects (all on Linux). My question is: how to I know which Intel Fortran libraries to pull in? Ive search the documentation but cant find anything to help me. At the moment Im getting the following unresolved: __svml_log2; __svml_pow2 and a message that says

/opt/intel/fce/10.1.008/lib/libifcore.so.5: undefined reference to `dlsym'

Any advice would be most welcome.

Thanks

Tony

You need libsvml.a for the __svml_log2 routine. I strongly recommend using ifort to do the link step.

Steve - Intel Developer Support

Thanks for your reply Steve. I will look into linking with ifort - in the meantime, the only error using gcc to link that I am getting now is

/opt/intel/fce/10.1.008/lib/libifcore.so.5: undefined reference to `dlsym'

Does that mean I am still missing an additional library? Thank you so much.

Tony

I found out the problem myself - I needed to add -ldl to my gcc link.

Leave a Comment

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