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). |
---|
|
source/dub/compilers/buildsettings.d |
---|
source/dub/compilers/dmd.d |
---|
source/dub/compilers/gdc.d |
---|
source/dub/compilers/ldc.d |
---|
source/dub/compilers/utils.d |
---|
test/2-dynLib-dep/dub.json |
---|
test/issue2258-dynLib-exe-dep/dub.json |
---|