Posix: Add default SONAME/install_name for dynamic libraries
Setting it to the filename (ELF) or `@rpath/<file name>` (Mach-O).

This seems to be required in order to use the libraries copied to
the output directory of dependees - either by setting the
LD_LIBRARY_PATH env var when starting the executable, or baking a
RUNPATH into the executable (e.g., via `patchelf --set-rpath` for
deployment).

Otherwise the loader tries to load the library from the original
location specified in the linking cmdline, which is some
`<path to dep pkg>/.dub/…` path (and apparently potentially
relative, and thus even more brittle). For ELF, I would assume
that all SONAME + DT_NEEDED entries (of executable + all .so libs)
would need to be post-processed to enable loading the libs from the
executable's directory (well, any non-original location).
1 parent f077aca commit 15a081b7cbf5553d9921d4acc57211b526980546
@Martin Kinkelin Martin Kinkelin authored on 17 Aug 2022
Mathias LANG committed on 30 Aug 2022
Showing 7 changed files
View
source/dub/compilers/buildsettings.d
View
source/dub/compilers/dmd.d
View
source/dub/compilers/gdc.d
View
source/dub/compilers/ldc.d
View
source/dub/compilers/utils.d
View
test/2-dynLib-dep/dub.json
View
test/issue2258-dynLib-exe-dep/dub.json