libtool
[Top][All Lists]
Advanced

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

Re: problems with LD_LIBRARY_PATH and libtool wrapper


From: Dan McMahill
Subject: Re: problems with LD_LIBRARY_PATH and libtool wrapper
Date: Fri, 05 Sep 2008 07:44:54 -0400
User-agent: Thunderbird 2.0.0.16 (Windows/20080708)

Ralf Wildenhues wrote:
My analysis was at least partly wrong:

* Ralf Wildenhues wrote on Thu, Aug 21, 2008 at 08:37:37AM CEST:
* Dan McMahill wrote on Wed, Aug 20, 2008 at 03:55:19AM CEST:
/bin/ksh ../libtool --tag=CC --mode=link gcc -g -O2 -Wall -Wl,-R/usr/pkg/lib -Wl,--rpath -Wl,/usr/pkg/lib -Wl,-R/usr/X11R6/lib -L/usr/pkg/lib
Here's your problem: something adds
  -Wl,-R/usr/pkg/lib -Wl,--rpath -Wl,/usr/pkg/lib

to the link line of your program.  Find out what that is, probably
either some flag in your Makefile.am or a configure macro.
[...]

I'm still wondering whether this is a bug in libtool though.
Namely:

If the user passes run paths with -R to libtool, should these run paths
be reordered to always appear _after_ those run paths added by libtool
which point to uninstalled locations?

If the user passes run paths with -R to libtool, then they _are_ already
put after all uninstalled run paths.  So this bug does not exist.

The issue then is one of users passing in run paths via other methods,
e.g., '-Wl,-R' or '-Wl,--rpath'.  Actually, there are two issues here:
First, the one Dan reported.  Second, the fact that it is not portable
to do so.  Even if the instance that added those paths would take care
to substitute the right system-specific linker flag, then there are
systems which allow only one such flag on the command line (with run
paths separated by colon or so).  So libtool _has_ to mangle them any
way.

We could just decree that passing -Wl,-rpath and the like to libtool is
not allowed, and one should always pass with -R.  Then the fix would be
a documentation clarification one only.

So, for you, Dan, that would mean tracking down whatever macro sets
those flags, and getting it to pass -R to libtool instead.  Or better
even not passing that: at least if the aim is to link against some
installed libraries, if those are libtool libraries, they should just
be listed as /foo/bar/libfoo.la.

ok.  It looks like it is coming from

  pkg-config --libs gtk+-2.0

which is called by way of PKG_CHECK_MODULES.  There is a
/usr/pkg/lib/libgtk.la but thats not what pkg-config puts out.  I'm
thinking thats because the .la is only useful if you're using libtool
for linking.


I guess what I don't see is why the libtool wrapper script doesn't do this:

LD_LIBRARY_PATH="/path/to/libmine/.libs:${LD_LIBRARY_PATH}:/usr/pkg/lib"

instead of

LD_LIBRARY_PATH="/usr/pkg/lib:/path/to/libmine/.libs:${LD_LIBRARY_PATH}"

In other words it seems like we always want our local .libs directory to come before other stuff and we might want to make our LD_LIBRARY_PATH setting from the environment come before a system path.

-Dan




reply via email to

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