libtool
[Top][All Lists]
Advanced

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

Re: wrong LD_LIBRARY_PATH in wrapper scripts


From: Dan Nicholson
Subject: Re: wrong LD_LIBRARY_PATH in wrapper scripts
Date: Mon, 12 Nov 2012 05:36:45 -0800

On Sat, Nov 10, 2012 at 11:28 AM, Poor Yorick
<address@hidden> wrote:
>> > On Nov 8, 2012 6:38 PM, "Poor Yorick" <address@hidden>
> [SNIP]
>>
>> the culprit turns out to be "/path/to/software/collection/lib/libffi.la", 
>> which was included in "dependency_libs" of  
>> /path/to/src/glib-2.32.4/glib-2.32.4/gobject/libgobject-2.0.la.  If I remove 
>> that, the error disappears.
>>
>> Here's a libtool command 
>> (pwd=/path/to/src/glib-2.32.4/glib-2.32.4/gobject/libgobject/tests) that 
>> creates a wrapper with the bad LD_LIBRARY_PATH:
>>
>> ../../libtool --tag=CC --mode=link gcc -m64 -g -O2 -Wall  
>> -L/path/to/src/glib-2.32.4/glib-2.32.4/glib/.libs  -o boxed boxed.o 
>> ../libgobject-2.0.la ../../gthread/libgthread-2.0.la 
>> ../../glib/libglib-2.0.la
>>
>> Now the question is how to systematically work around such problems?  Editing
>> any of the .la files doesn't seem right.  Is there something I can add to my
>> build environment or configuration options?
>>
>
> I tried various things to try to get libtool to do the right thing, but 
> finally
> just made a symylink to libffi 
> /path/to/src/glib-2.32.4/glib-2.32.4/glib/.libs,
> which convinced libtool not to add /path/to/software/collection/lib to the
> LD_LIBRARY_PATH in the wrappers scripts.  I wish I could have found a less
> ughly hack, or even a good fix.
>
> Ref: http://bugzilla.gnome.org/show_bug.cgi?id=688054

I'm pretty sure this is not a bug in glib, but just a tricky libtool
bug. glib is simply telling libtool that it wants to link a program
against its 3 in-tree libraries, and the hard part is that not all of
the in-tree libraries need to link to installed libraries. libtool is
appropriately figuring out which installed libraries are needed and
making an almost correct LD_LIBRARY_PATH so that you don't have to
fiddle with anything to run the program. What libtool could do is take
it's calculated portion of the path and sort it so that any paths that
are within the build directory come first. Something like this (I
haven't looked at libtool):

for path in `IFS=: echo $computed_library_path`; do
    case "$path" in
    "$builddir"/*) pre_path="${pre_path+$pre_path:}$path" ;;
    *) post_path="${post_path+$post_path:}$path" ;;
    esac
done

LD_LIBRARY_PATH="${pre_path+$pre_path:}${post_path+$post_path:}$LD_LIBRARY_PATH"

--
Dan



reply via email to

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