[Top][All Lists]

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

Problem found: libtool/ pulling in wrong stdc++

From: Graham Leggett
Subject: Problem found: libtool/ pulling in wrong stdc++
Date: Fri, 5 Aug 2005 15:26:30 +0200 (SAST)
User-agent: SquirrelMail/1.4.3a-11.EL4

Hi all,

I have found the reason for libtool linking to the wrong stdc++, the
problem is that I don't know libtool well enough to propose the "right"

The problem plays out like this:

- The stdc++ library is added to the "postdeps" environment variable, like

postdeps="-lstdc++ -lm -lgcc_s -lgcc_s"

- libtool loops through a search path of directories to find this and
other libraries:

for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_
path $shlib_search_path; do

- The variable "lib_search_path" contains the value below:

<sourcetree>/src/cpp/eod /usr/local/lib

This variable takes precedance over the compiler paths in
"sys_lib_search_path" and the system paths in "shlib_search_path".

What makes things blow up is the "/usr/local/lib" above - this effectively
means that any libstdc++ installed in /usr/local/lib is going to take
precedance over the compiler specific libstdc++ that is listed in

- How did the /usr/local/lib get there in the first place? It was
specified to libtool as a -L option on the command line below, which in
turn came from LDFLAGS:

> /bin/bash ../../libtool --tag=CC --mode=link gcc  -I.. -I../..
> -I/usr/local/include/libxml2  -L/usr/local/lib -R/usr/local/lib -lxml2 -lz
> -lpthread -liconv -lm -lsocket -lnsl -o -rpath
> /udd001/hoops/usr/lib  version.lo ../rtxsrc/
> ../rtxmlsrc/ eod/ -lxml2 -liconv
> -lnsl -lsocket -lz -lm -lc

- How did -L/usr/local/lib get into LDFLAGS? The libxml2 dependancy did it:

bash-2.03$ /usr/local/bin/xml2-config --libs
-L/usr/local/lib -R/usr/local/lib -lxml2 -lz -lpthread -liconv -lm
-lsocket -lnsl

So - is the solution to reorder the $lib_search_path and the
$sys_lib_search_path so that sys_lib_search_path is considered first?

Or do we handle postdeps specially to ignore $lib_search_path and consider
$sys_lib_search_path only for these libraries?

Not sure what the "right" way is to do this.


reply via email to

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