summaryrefslogtreecommitdiff
path: root/LICENSE-MIT
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-09-30 20:32:50 +0200
committerGitHub <noreply@github.com>2024-09-30 20:32:50 +0200
commit02499c72c9cbc059dc58577923e8fe983876f173 (patch)
tree023cdd748abf851dcef2751a2835a9a9d016901a /LICENSE-MIT
parentf1275536a211f57eea1316f0f01807e8a8fe3bd0 (diff)
downloadspack-02499c72c9cbc059dc58577923e8fe983876f173.tar.gz
spack-02499c72c9cbc059dc58577923e8fe983876f173.tar.bz2
spack-02499c72c9cbc059dc58577923e8fe983876f173.tar.xz
spack-02499c72c9cbc059dc58577923e8fe983876f173.zip
avoid rpath'ing default search paths (#44686)
On sysroot systems like gentoo prefix, as well as nix/guix, our "is system path" logic is broken cause it's static. Talking about "the system paths" is not helpful, we have to talk about default search paths of the dynamic linker instead. If glibc is recent enough, we can query the dynamic loader's default search paths, which is a much more robust way to avoid registering rpaths to system dirs, which can shadow Spack dirs. This PR adds an **additional** filter on rpaths the compiler wrapper adds, dropping rpaths that are default search paths. The PR **does not** remove any of the original `is_system_path` code yet. This fixes issues where build systems run just-built executables linked against their *not-yet-installed libraries*, typically: ``` LD_LIBRARY_PATH=. ./exe ``` which happens in `perl`, `python`, and other non-cmake packages. If a default path is rpath'ed, it takes precedence over `LD_LIBRARY_PATH`, and a system library gets loaded instead of the just-built library in the stage dir, breaking the build. If default paths are not rpath'ed, then LD_LIBRARY_PATH takes precedence, as is desired. This PR additionally fixes an inconsistency in rpaths between cmake and non-cmake packages. The cmake build system computed rpaths by itself, but used a different order than computed for the compiler wrapper. In fact it's not necessary to compute rpaths at all, since we let cmake do that thanks to `CMAKE_INSTALL_RPATH_USE_LINK_PATH`. This covers rpaths for all dependencies. The only install rpaths we need to set are `<install prefix>/{lib,lib64}`, which cmake unfortunately omits, although it could also know these. Also, cmake does *not* delete rpaths added by the toolchain (i.e. Spack's compiler wrapper), so I don't think it should be controversial to simplify things.
Diffstat (limited to 'LICENSE-MIT')
0 files changed, 0 insertions, 0 deletions