[lsb-discuss] Missing symbols when using ifort for mixed C/Fortran

Robert Schweikert rschweikert at novell.com
Sat Jan 8 04:02:22 PST 2011

Hi Craig,

On 01/07/2011 09:12 PM, Craig Scott wrote:
> Ran into an interesting problem today. I have a 64-bit machine (SLED 11) on which I'm building some mixed C/Fortran code using the intel ifort compiler. This particular combination builds fine with ifort/gcc on various platforms (32- and 64-bit, various flavours of linux). However, if I build the C parts with the lsbcc compiler instead, then when ifort goes to link a program I see the following error:
> /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crt1.o: In function `_start':
> /usr/src/packages/BUILD/glibc-2.9/csu/../sysdeps/x86_64/elf/start.S:106: undefined reference to `__libc_csu_fini'
> /usr/src/packages/BUILD/glibc-2.9/csu/../sysdeps/x86_64/elf/start.S:107: undefined reference to `__libc_csu_init'
> The command that leads to this is:
> /opt/intel/Compiler/11.1/064/bin/intel64/ifort -assume old_logical_ldio -O3 -o someapp someapp.f -L`pwd` -lpgplot -L/opt/lsb/lib64-4.0 -lX11

Don't do that ;)

In my experience it has been much easier to get get mixed code to link
when using the C/C++ driver to link, i.e. use a two step process:

1.) compile with ifort
-> ifort -c -assume old_logical_ldio -O3 -o someapp.o someapp.f
2.) link with he C driver
-> lsbcc -o someapp -L`pwd`
-L/opt/intel/Compiler/11.1/064/bin/intel64/lib -lifport -lifcoremt

The reason for this is that the C/C++ compiler drivers have a lot of
internal knowledge about where to find the right libraries what
libraries to link etc. These from your point of view hidden libraries
are mostly related to getting the runtime stuff right and include things
like crt0 and other stuff.

Yes, this implies that the start of the program is implemented as a
C/C++ main, but that is easy and it is much easier to deal with command
line arguments in C/C++ anyway.


Robert Schweikert                           MAY THE SOURCE BE WITH YOU
Software Engineer Consultant                          LINUX
rschweikert at novell.com

Making IT Work As One

More information about the lsb-discuss mailing list