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

Wichmann, Mats D mats.d.wichmann at intel.com
Sat Jan 8 04:53:51 PST 2011

lsb-discuss-bounces at lists.linux-foundation.org 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/sta 
rt.S:106: undefined reference to `__libc_csu_fini'
> /usr/src/packages/BUILD/glibc-2.9/csu/../sysdeps/x86_64/elf/sta
rt.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 
> Since this problem is specific to using the lsbcc compiler in
> this context, I thought I'd ask if anyone here has any ideas
> about what might be going on. The only references I can find
> online to something vaguely like this talk about a missing
> 32-bit glibc library, but I'm not yet convinced this applies
> here (and if it did, I'm not sure how we could deal with it in a
> LSB-friendly way). 
> Let's not worry about whether the resulting binary would
> actually be LSB-compatible just yet. Just getting it to build
> is step 1, after which I can then check if any non-LSB symbols
> exist in the resultant binaries.

you're not picking up libc_nonshared.a somehow, is what it
looks like.

When you link a binary with gcc, it picks up libc.so which is
actually not a library, but a linker script, and contains
an instruction to use libc_nonshared.a.  Since in the LSB
context, we don't use this file, lsbcc "knows" internally
to add the instruction to include libc_nonshared.

We need to make sure that's happening when you use ifort.
As Robert says, if it can be arranged, you're better off
using lsbcc to do the final link, as it has the info to
get this stuff right for itself.

More information about the lsb-discuss mailing list