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 <vinc...@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)