config:shared_linking:missing_library_policy to error/warn about accidental use of system libraries on linux/freebsd (#47365)

This commit adds a config option `config:shared_linking:missing_library_policy:error/warn/ignore` which will cause installation errors or warnings when ELF executables or libraries need shared libraries which cannot be resolved from RPATH search paths. The default is to ignore.

This is a safeguard against accidentally linking to system libraries instead of Spack libraries. It makes it more likely that build cache installs work on different machines. It works only at the level of libraries, not at the level of symbols. Some system dependencies are allowed (e.g. kernel and libc).

Packages can (but are discouraged to) set `unresolved_libraries` to a list of patterns of sonames/library names that are know to be unresolvable in RPATHs.  In the future this could be made more fine-grained in a non-breaking way by allowing a dictionary of patterns `lib => [deps]`.
This commit is contained in:
Harmen Stoppels
2024-12-16 12:32:36 +01:00
committed by GitHub
parent 557083c33b
commit 06eae96ef9
24 changed files with 335 additions and 20 deletions

View File

@@ -1,5 +1,7 @@
config:
db_lock_timeout: 120
shared_linking:
missing_library_policy: error
install_tree:
root: /home/software/spack
padded_length: 256

View File

@@ -8,6 +8,10 @@ spack:
reuse: false
unify: false
config:
shared_linking:
missing_library_policy: ignore # due to use of externals
packages:
all:
prefer:

View File

@@ -8,6 +8,10 @@ spack:
reuse: false
unify: false
config:
shared_linking:
missing_library_policy: ignore # due to use of externals
packages:
all:
require: '%gcc'