[Top][All Lists]

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

libtool 1.4.3 searches /usr/lib before -L<dir>

From: Pierre Sarrazin
Subject: libtool 1.4.3 searches /usr/lib before -L<dir>
Date: Mon, 20 Oct 2003 19:32:21 -0400
User-agent: Mutt/1.4.1i

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/ -lpthread -lz -lm

The `-lverbiste-0.1' has been expanded to `/usr/lib/'
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:

        undefined reference to

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
        if test -f "$lib"; then

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'

The directory specified with -L was added after /usr/lib.
This explains why 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/

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 <sarrazip at sympatico dot ca>

reply via email to

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