I've got a Linux executable build going where I've set the rpath through the linker flags "-Wl,-rpath,./ -Wl,--disable-new-dtags"
, and I've verified through readelf -d that the RPATH is being set to ./
This works for direct dependencies, as my executable is able to find them when placed in the same directory. This isn't working for dependencies-of-dependencies though:
46763: find library=libpulsecommon-13.99.so [0]; searching
46763: search path=/usr/lib/x86_64-linux-gnu/pulseaudio/tls/x86_64/x86_64:/usr/lib/x86_64-linux-gnu/pulseaudio/tls/x86_64:/usr/lib/x86_64-linux-gnu/pulseaudio/tls/x86_64:/usr/lib/x86_64-linux-gnu/pulseaudio/tls:/usr/lib/x86_64-linux-gnu/pulseaudio/x86_64/x86_64:/usr/lib/x86_64-linux-gnu/pulseaudio/x86_64:/usr/lib/x86_64-linux-gnu/pulseaudio/x86_64:/usr/lib/x86_64-linux-gnu/pulseaudio
(RUNPATH from file ./libpulse.so.0)
Here, libpulse is looking for libpulsecommon using its own runpath, which doesn't contain the immediate relative path. I had switched to using rpath instead of runpath because I saw it mentioned that rpath should propagate to dependencies (whereas runpath is "every binary handles itself"). This doesn't seem to be the case, though.
What's the proper way to set up a Linux executable so that any dependencies that I provide in the same directory will be found by it and its dependencies?