libtool 1.4.3 searches /usr/lib before -L

2003-10-20 Thread Pierre Sarrazin
I'm having a problem related to the path that libtool (1.4.3)
uses to search for libraries.

I have a C++ package that contains a library and two command-line
tools.  If I install this package through an RPM (on a RedHat 8.0
system), I endup with the lib*.la and lib*.so files in /usr/lib.
I get into trouble when I compile the sources of a newer version
of the package, while the older version is still installed.

For example, I deploy the newer version in /home/ps/cvswork/verbiste.
The library sources are in src/verbiste, and its .libs subdirectory.

The command-line tool sources are in src/commands.  The library is
compiled first, then the command-line tools.  The error happens when
trying to link the first of those tools.

The libtool command that is run by make is the following:

/bin/sh ../../libtool --mode=link g++  -g -Wall
-o french-conjugator
french_conjugator-french-conjugator.o french_conjugator-Command.o
-lxml2 -lpthread -lz -lm
-L../verbiste -lverbiste-0.1

The -L option correctly points to the src/verbiste directory, where the
newer library has been compiled.  However, libtool generates this g++
command to do the linking:

g++ -g -Wall -o french-conjugator
french_conjugator-french-conjugator.o french_conjugator-Command.o
/usr/lib/libxml2.so -lpthread -lz -lm
-L/home/ps/cvswork/verbiste/src/verbiste
/usr/lib/libverbiste-0.1.so

The `-lverbiste-0.1' has been expanded to `/usr/lib/libverbiste-0.1.so'
because the older version of the library is currently installed as an
RPM under /usr.  This causes a linking error because the older library
does not have the functions that are expected by the newer code:

/home/ps/cvswork/verbiste/src/commands/french-conjugator.cpp:110:
undefined reference to
`verbiste::FrenchVerbDictionary::getTenseName(verbiste::Tense)'

I wondered why libtool searched a system directory (/usr/lib) before
the explicitly specified one (../verbiste).  I opened ../../libtool
and found this (backslash added by me):

  for searchdir in $newlib_search_path $lib_search_path \
$sys_lib_search_path $shlib_search_path; do
# Search the libtool library
lib="$searchdir/lib${name}.la"
if test -f "$lib"; then
  found=yes
  break
fi
  done

By inserting echo statements before this loop, I observed this (long
line cut by me):

newlib_search_path=' /usr/lib /home/ps/cvswork/verbiste/src/verbiste'
lib_search_path='/home/ps/cvswork/verbiste/src/commands 
/home/ps/cvswork/verbiste/src/verbiste'

The directory specified with -L was added after /usr/lib.
This explains why libverbiste-0.1.la is found in /usr/lib instead
of where -L specified.

The workaround is to uninstall the older library, or at least to
move away /usr/lib/libverbiste-0.1.la.

Is there a clean way to ask libtool to search a certain directory
before any system directory?

My project is autoconfiscated with autoconf 2.57, automake 1.7.2
and libtool 1.4.3.  Also, I use g++ 3.2 on a RedHat 8.0 system.

-- 
Pierre Sarrazin 


___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool


Re: dependency_libs issue

2003-10-20 Thread Albert Chin
On Mon, Sep 08, 2003 at 04:38:40PM +1000, Clinton Roy wrote:
> I've got code in configure.ac that eventually sets LIBS to:
> LIBS = -lgdbm  -L/dstc/lib -lxml2 -lz -lpthread -lm -ldb
> 
> However, ltmain.sh produces a .la file with:
> 
> dependency_libs=' /usr/lib/libgdbm.la -L/dstc/lib /usr/lib/libxml2.la -lz -lpthread 
> -lm -ldb'
> 
> How did that /usr/lib/libxml2.la get in there?

Does this fix it (should apply to 1.5)?

-- 
albert chin ([EMAIL PROTECTED])

-- snip snip
Index: ltmain.in
===
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.334.2.7
diff -u -3 -p -r1.334.2.7 ltmain.in
--- ltmain.in   31 Jul 2003 20:46:40 -  1.334.2.7
+++ ltmain.in   20 Oct 2003 10:31:08 -
@@ -2626,7 +2629,7 @@ EOF
done
   fi
   if test "$pass" != dlopen; then
-   if test "$pass" != conv; then
+   if test "$pass" != conv && test -n "$newlib_search_path" ; then
  # Make sure lib_search_path contains only unique directories.
  lib_search_path=
  for dir in $newlib_search_path; do


___
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool