implicit rpaths filtering (#12789)
* implicit_rpaths are now removed from compilers.yaml config and are always instantiated dynamically, this occurs one time in the build_environment module * per-compiler list required libraries (e.g. libstdc++, libgfortran) and whitelist directories from rpaths including those libraries. Remove non-whitelisted implicit rpaths. Some libraries default for all compilers. * reintroduce 'implicit_rpaths' as a config variable that can be used to disable Spack insertion of compiler RPATHs generated at build time.
This commit is contained in:

committed by
Greg Becker

parent
b11a98abf0
commit
141a1648e6
@@ -9,6 +9,7 @@
|
||||
import fileinput
|
||||
import glob
|
||||
import grp
|
||||
import itertools
|
||||
import numbers
|
||||
import os
|
||||
import pwd
|
||||
@@ -68,6 +69,32 @@ def path_contains_subdirectory(path, root):
|
||||
return norm_path.startswith(norm_root)
|
||||
|
||||
|
||||
def possible_library_filenames(library_names):
|
||||
"""Given a collection of library names like 'libfoo', generate the set of
|
||||
library filenames that may be found on the system (e.g. libfoo.so). This
|
||||
generates the library filenames that may appear on any OS.
|
||||
"""
|
||||
lib_extensions = ['a', 'la', 'so', 'tbd', 'dylib']
|
||||
return set(
|
||||
'.'.join((lib, extension)) for lib, extension in
|
||||
itertools.product(library_names, lib_extensions))
|
||||
|
||||
|
||||
def paths_containing_libs(paths, library_names):
|
||||
"""Given a collection of filesystem paths, return the list of paths that
|
||||
which include one or more of the specified libraries.
|
||||
"""
|
||||
required_lib_fnames = possible_library_filenames(library_names)
|
||||
|
||||
rpaths_to_include = []
|
||||
for path in paths:
|
||||
fnames = set(os.listdir(path))
|
||||
if fnames & required_lib_fnames:
|
||||
rpaths_to_include.append(path)
|
||||
|
||||
return rpaths_to_include
|
||||
|
||||
|
||||
def same_path(path1, path2):
|
||||
norm1 = os.path.abspath(path1).rstrip(os.path.sep)
|
||||
norm2 = os.path.abspath(path2).rstrip(os.path.sep)
|
||||
|
Reference in New Issue
Block a user