-Wl,-rpath emits RUNPATH now: transitive .so deps aren't found
On Ubuntu 24.04 (gcc 13.3, binutils 2.42), -Wl,-rpath,'$ORIGIN/lib' writes DT_RUNPATH, not DT_RPATH (check with readelf -d bin | grep -E 'RPATH|RUNPATH'). RUNPATH only applies to the binary's own direct NEEDED entries. If main -> libb.so -> liba.so, and both live in $ORIGIN/lib, the program fails with 'error while loading shared libraries: liba.so: cannot open shared object file' (rc=127). Linking also needs -Wl,-rpath-link,lib for the transitive library. Fixes, all tested: give libb.so its own -Wl,-rpath,'$ORIGIN', which is the clean one, or link main with -Wl,--disable-new-dtags to get an old-style RPATH, which is searched for transitive deps too. Precedence also differs: LD_LIBRARY_PATH overrides RUNPATH but not RPATH. With a decoy liba.so on LD_LIBRARY_PATH, the RUNPATH binary loaded the decoy and the RPATH binary ignored it.