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) --- var/spack/repos/builtin/packages/cuda/package.py | 3 +++ var/spack/repos/builtin/packages/nvhpc/package.py | 3 +++ var/spack/repos/builtin/packages/openjdk/package.py | 5 +++++ 3 files changed, 11 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py index e8157b54ae..2375e318af 100644 --- a/var/spack/repos/builtin/packages/cuda/package.py +++ b/var/spack/repos/builtin/packages/cuda/package.py @@ -583,3 +583,6 @@ class Cuda(Package): if "compat" not in parts and "stubs" not in parts: filtered_libs.append(lib) return LibraryList(filtered_libs) + + # Avoid binding stub libraries by absolute path + non_bindable_shared_objects = ["stubs"] diff --git a/var/spack/repos/builtin/packages/nvhpc/package.py b/var/spack/repos/builtin/packages/nvhpc/package.py index b7e625b97c..2ade4bc9e6 100644 --- a/var/spack/repos/builtin/packages/nvhpc/package.py +++ b/var/spack/repos/builtin/packages/nvhpc/package.py @@ -415,3 +415,6 @@ class Nvhpc(Package): libs.append("libnvf") return find_libraries(libs, root=prefix, recursive=True) + + # Avoid binding stub libraries by absolute path + non_bindable_shared_objects = ["stubs"] diff --git a/var/spack/repos/builtin/packages/openjdk/package.py b/var/spack/repos/builtin/packages/openjdk/package.py index 6382dc3688..fab50a28f8 100644 --- a/var/spack/repos/builtin/packages/openjdk/package.py +++ b/var/spack/repos/builtin/packages/openjdk/package.py @@ -413,3 +413,8 @@ class Openjdk(Package): class_paths = find(dependent_spec.prefix, "*.jar") classpath = os.pathsep.join(class_paths) env.prepend_path("CLASSPATH", classpath) + + # Since we provide openjdk as a binary, we can't remove an obsolete glibc + # fix that prevents us from modifying the soname of libjvm.so. If we move + # to source builds this should be possible. + non_bindable_shared_objects = ["libjvm.so"] -- cgit v1.2.3-60-g2f50