Hi all,

I am trying to link a library and test program in an autotools-based
project using Intel C++ 9.1.042 and GCC 4.1.2.

One of my machines has a default installation of GCC (3.3.6). I built and installed gcc-4.1.2 and icc-9.1.042 in /opt/compilers. My goal is to
link the project's library and test program with the GCC libstdc++
in /opt/compilers/gcc-4.1.2, not the one in /usr/lib. The Intel compiler driver picks up by default the gcc libstdc++ to link with instead of itw own C++ Standard Library, as explained in the man page:

-cxxlib-<mode> tell the compiler which C++ run-time libraries to use:
   gcc[=dir] - link using C++ run-time libraries provided with gcc
              (default on systems running gcc 3.2 or above)
               dir is an optional top-level location for the gcc
               binaries and libraries

The issue seems to be similar with one posted a while ago by Taj Morton. While in his case a KDE library was pulling in the /usr/lib/ libstdc++, my project does not have such a dependency.

$ echo $PATH


$ for f in automake libtool; do which $f; $f --version; done
automake (GNU automake) 1.9.6
Written by Tom Tromey <[EMAIL PROTECTED]>.


ltmain.sh (GNU libtool) 1.5.22 (1.1220.2.365 2005/12/18 22:14:06)


I build using:

$ ./configure --enable-shared CXX=icpc && make clean && make

and I obtain (among other interesting info):

ld: warning: libstdc++.so.6, needed by /tmp/ford/source/.libs/libford.so, may conflict with libstdc++.so.5

Rightly so, because:

$ ldd source/.libs/libford.so
        linux-gate.so.1 =>  (0xffffe000)
libimf.so => /opt/compilers/intel-9.1.042/lib/libimf.so (0xb7d14000)
        libm.so.6 => /lib/tls/libm.so.6 (0xb7cdf000)
        libstdc++.so.5 => /usr/lib/./libstdc++.so.5 (0xb7c27000)
libcxaguard.so.5 => /opt/compilers/intel-9.1.042/lib/libcxaguard.so.5 (0xb7c25000) libirc.so => /opt/compilers/intel-9.1.042/lib/libirc.so (0xb7be4000)
        libgcc_s.so.1 => /usr/lib/./libgcc_s.so.1 (0xb7bdb000)
        libdl.so.2 => /lib/tls/libdl.so.2 (0xb7bd6000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb7aba000)
libstdc++.so.6 => /opt/compilers/gcc-4.1.2/lib/libstdc++.so.6 (0xb79d7000)
        /lib/ld-linux.so.2 (0x80000000)

See the dependency on both libstdc++ installations.

I check the library building in source dir:

/bin/sh ../libtool --tag=CXX --mode=link icpc -g -O2 -o libford.la -rpath /usr/local/lib -release 0.0.1 lib.lo icpc -shared .libs/lib.o -Wl,-rpath,/usr/lib/. -Wl,-rpath,/usr/lib/. -L/opt/compilers/intel-9.1.042/lib -L/opt/compilers/gcc-4.1.2/lib/gcc/i486-slackware-linux/4.1.2/ -L/opt/compilers/gcc-4.1.2/lib/gcc/i486-slackware-linux/4.1.2/../../../ -L/usr/lib -limf -lm -lipgo /usr/lib/./libstdc++.so [...]

and sure enough here is "/usr/lib/./libstdc++.so".

I have attached the output of the libtool invocation with --debug, hoping that you could make more sense out of it than I could.

I need to mention that on another system which does not have a default gcc compiler installed in /usr, but uses Intel C++ & gcc in /opt/compilers, I see no such problems.

How do I go about linking with the custom built GCC libstdc++ on the system which has a default GCC installed in /usr/lib?


Attachment: libtool-lib-link.out.gz
Description: application/gzip


Reply via email to