[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libtool/ltmain linking wrong (/usr/lib) libstdc++

From: Liviu Nicoara
Subject: libtool/ltmain linking wrong (/usr/lib) libstdc++
Date: Fri, 20 Apr 2007 10:50:46 -0400
User-agent: Thunderbird (X11/20070221)

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 <address@hidden>.


/usr/local/bin/libtool (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:, needed by /tmp/ford/source/.libs/, may conflict with

Rightly so, because:

$ ldd source/.libs/ =>  (0xffffe000) => /opt/compilers/intel-9.1.042/lib/ (0xb7d14000) => /lib/tls/ (0xb7cdf000) => /usr/lib/./ (0xb7c27000) => /opt/compilers/intel-9.1.042/lib/ (0xb7c25000) => /opt/compilers/intel-9.1.042/lib/ (0xb7be4000) => /usr/lib/./ (0xb7bdb000) => /lib/tls/ (0xb7bd6000) => /lib/tls/ (0xb7aba000) => /opt/compilers/gcc-4.1.2/lib/ (0xb79d7000)
        /lib/ (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 -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/./ [...]

and sure enough here is "/usr/lib/./".

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

[Prev in Thread] Current Thread [Next in Thread]