From b52be759788cf20f1458c80e6e005744f5856c73 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Fri, 4 Nov 2022 00:34:00 +0100 Subject: Experimental binding of shared ELF libraries (#31948) Adds another post install hook that loops over the install prefix, looking for shared libraries type of ELF files, and sets the soname to their own absolute paths. The idea being, whenever somebody links against those libraries, the linker copies the soname (which is the absolute path to the library) as a "needed" library, so that at runtime the dynamic loader realizes the needed library is a path which should be loaded directly without searching. As a result: 1. rpaths are not used for the fixed/static list of needed libraries in the dynamic section (only for _actually_ dynamically loaded libraries through `dlopen`), which largely solves the issue that Spack's rpaths are a heuristic (`/lib` and `/lib64` might not be where libraries really are...) 2. improved startup times (no library search required) --- etc/spack/defaults/config.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'etc/spack') diff --git a/etc/spack/defaults/config.yaml b/etc/spack/defaults/config.yaml index e72608248f..b3356428fe 100644 --- a/etc/spack/defaults/config.yaml +++ b/etc/spack/defaults/config.yaml @@ -187,10 +187,20 @@ config: package_lock_timeout: null - # Control whether Spack embeds RPATH or RUNPATH attributes in ELF binaries. - # Has no effect on macOS. DO NOT MIX these within the same install tree. - # See the Spack documentation for details. - shared_linking: 'rpath' + # Control how shared libraries are located at runtime on Linux. See the + # the Spack documentation for details. + shared_linking: + # Spack automatically embeds runtime search paths in ELF binaries for their + # dependencies. Their type can either be "rpath" or "runpath". For glibc, rpath is + # inherited and has precedence over LD_LIBRARY_PATH; runpath is not inherited + # and of lower precedence. DO NOT MIX these within the same install tree. + type: rpath + + + # (Experimental) Embed absolute paths of dependent libraries directly in ELF + # binaries to avoid runtime search. This can improve startup time of + # executables with many dependencies, in particular on slow filesystems. + bind: false # Set to 'false' to allow installation on filesystems that doesn't allow setgid bit -- cgit v1.2.3-70-g09d2