bug-libtool
[Top][All Lists]
Advanced

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

problem with the way libtool works (bug or feature)


From: Walter Truitt
Subject: problem with the way libtool works (bug or feature)
Date: Mon, 13 Nov 2000 15:23:32 -0600

I am running on a Sun Ultra5, solaris 2.6 machine.  I frequently install
packages to a local directory on the machine (/local/wtruitt).  I
specifically refuse to set an LD_LIBRARY_PATH environment variable for
libraries that I have installed in my /local/wtruitt/lib directory.

You may think of this /local/wtruitt as the same as a /usr/local
directory used by many.  The same issues would apply.

Specifically, with the shared library is a program with multiple entry
points philosophy in the info pages, I would like for the libraries to
contain the runtime library path for the libraries they depend upon.

I find this issue most important when the libraries are used as
modules.  I have been compiling several different packages (GNOME and
all), and several of the libraries it uses are linked to automatically
load other libraries.  These do not work until I recreate the library
with the runtime path in the link line.  I notice that the -rpath flag
is passed to the libtool script, but libtool seems to use this as an
argument to create -L options to ld.

I have looked into the script, and would guess it is a simple addition
of the -R in one of the places that the -L is included in the line.  If
you are interested in a patch, I can submit one as well.

The info pages I looked into were in the libtool-1.2e version of
libtool.  The versions used in the packages I installed are the ones
they included.  A simple test of the 1.2e shows that it has the same
behavior.

$ libtool --mode=link gcc -O -o libhello.la hello.lo -rpath
/local/wtruitt/lib \
> -version-info 0:0:0 -L/local/wtruitt/lib -lXpm
rm -fr .libs/libhello.la .libs/libhello.* .libs/libhello.*
/usr/ccs/bin/ld -G -h libhello.so.0 -o .libs/libhello.so.0.0.0 
hello.lo  -L/local/wtruitt/lib -lXpm -lc
(cd .libs && rm -f libhello.so.0 && ln -s libhello.so.0.0.0
libhello.so.0)
(cd .libs && rm -f libhello.so && ln -s libhello.so.0.0.0 libhello.so)
ar cru .libs/libhello.a  hello.o 
ranlib .libs/libhello.a
creating libhello.la
(cd .libs && rm -f libhello.la && ln -s ../libhello.la libhello.la)

Here libXpm.so is a library that exists in /local/wtruitt/lib:
$ ls -F /local/wtruitt/lib/libXpm.so*
/local/wtruitt/lib/libXpm.so@      /local/wtruitt/lib/libXpm.so.4.6@
/local/wtruitt/lib/libXpm.so.4.11
$ ldd .libs/libhello.so.0.0.0
        libXpm.so.4.11 =>        (file not found)
        libc.so.1 =>     /usr/lib/libc.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1

Here is where the problems arise:
$ libtool --mode=link gcc -o hello main.o -rpath /local/wtruitt/lib \
> -L/local/wtruitt/lib -lhello -lX11
gcc -o hello main.o -L/local/wtruitt/lib -lhello -lX11
-R/local/wtruitt/lib
$ ldd hello
        libhello.so.0 =>         /local/wtruitt/lib/libhello.so.0
        libX11.so.4 =>   /usr/lib/libX11.so.4
        libc.so.1 =>     /usr/lib/libc.so.1
        libXpm.so.4.11 =>        (file not found)
        libXext.so.0 =>  /usr/openwin/lib/libXext.so.0
        libsocket.so.1 =>        /usr/lib/libsocket.so.1
        libnsl.so.1 =>   /usr/lib/libnsl.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libmp.so.2 =>    /usr/lib/libmp.so.2
        /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1

Even though the libXpm.so.4.11 is in the /local/wtruitt/lib directory,
it is not found.  You may blame this on the operating system.  I do not
know the behavior on other systems.  If the libhello has the
-R/local/wtruitt/lib included in the ld command to create the shared
library, this error does not occur.

 -walter

Pardon me,  I was looking at a version that still worked.  After looking
at the script, I found that if I had invoked it with a
-R/local/wtruitt/lib, it would have added that.  I then looked at the
version used in the packages I installed.

LIBTOOL BROKE between 1.2e and 1.3.5!!

I downloaded the latest from ftp.gnu.org/pub/gnu/libtool
(libtool-1.3.5.tar.gz), and running with that libtool the -R is not
included:

$ libtool --mode=link gcc -O -o libhello.la hello.lo \
> -rpath /local/wtruitt/lib -R /local/wtruitt/lib -version-info 0:0:0 \
> -L/local/wtruitt/lib -lXpm
rm -fr .libs/libhello.la .libs/libhello.* .libs/libhello.*
/usr/ccs/bin/ld -G -h libhello.so.0 -o .libs/libhello.so.0.0.0 
hello.lo  -L/local/wtruitt/lib -lXpm -lc 
(cd .libs && rm -f libhello.so.0 && ln -s libhello.so.0.0.0
libhello.so.0)
(cd .libs && rm -f libhello.so && ln -s libhello.so.0.0.0 libhello.so)
ar cru .libs/libhello.a  hello.o 
ranlib .libs/libhello.a
creating libhello.la
(cd .libs && rm -f libhello.la && ln -s ../libhello.la libhello.la)

 -walter (a second time)



reply via email to

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