libtool
[Top][All Lists]
Advanced

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

Re: LD_LIBRARY_PATH set by wrapper on Ubuntu, not on Rocky (Redhat)


From: Vincent Lefevre
Subject: Re: LD_LIBRARY_PATH set by wrapper on Ubuntu, not on Rocky (Redhat)
Date: Mon, 5 Sep 2022 04:35:43 +0200
User-agent: Mutt/2.2.7+37 (a90f69b9) vl-149028 (2022-09-02)

On 2022-09-04 20:52:07 -0500, Corey Minyard wrote:
> It compiles a program with -rpath and expects to see the set rpath
> appear after RUNPATH.  On the system that works:
> 
>   $ gcc -o hello hello.c -Wl,-rpath -Wl,/foo
>   $ objdump -p hello | grep RUNPATH
>     RUNPATH              /foo
> 
> However, on the system that doesn't work:
> 
>   $ gcc -o hello hello.c -Wl,-rpath -Wl,/foo
>   $ objdump -p hello | grep RUNPATH
>   $ objdump -p hello | grep foo
>     RPATH                /foo
> 
> Doing a little research, it looks like RPATH overrides LD_LIBRARY_PATH
> which overrides RUNPATH.  Well, ok, so the whole relinking thing is
> required in the RPATH.
> 
> However, in order for dlopen-ed modules to work per the libtool
> documentation, LD_LIBRARY_PATH should still be set, even if -rpath
> overrides it.  There's no reason to not set it, is there?
> 
> Outside of that, it looks like I can work around this by adding
> LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
> before LT_INIT.

If the wrapper doesn't touch LD_LIBRARY_PATH, you'd rather need
LDFLAGS="$LDFLAGS -Wl,--disable-new-dtags" so that the user's
LD_LIBRARY_PATH will not get in the way (--disable-new-dtags
makes the runpath override LD_LIBRARY_PATH). This is what I've
done for MPFR (where we do not generate wrappers, so that
LD_LIBRARY_PATH cannot be "fixed").

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



reply via email to

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