diff options
Diffstat (limited to 'lib/spack/spack/detection/path.py')
-rw-r--r-- | lib/spack/spack/detection/path.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/spack/spack/detection/path.py b/lib/spack/spack/detection/path.py index b7a7f6702d..bf42fa6144 100644 --- a/lib/spack/spack/detection/path.py +++ b/lib/spack/spack/detection/path.py @@ -17,6 +17,7 @@ import llnl.util.tty import spack.operating_systems.windows_os as winOs import spack.util.environment +import spack.util.ld_so_conf from .common import ( DetectedPackage, @@ -75,9 +76,10 @@ def executables_in_path(path_hints=None): return path_to_exe -def libraries_in_ld_library_path(path_hints=None): +def libraries_in_ld_and_system_library_path(path_hints=None): """Get the paths of all libraries available from LD_LIBRARY_PATH, - LIBRARY_PATH, DYLD_LIBRARY_PATH, and DYLD_FALLBACK_LIBRARY_PATH. + LIBRARY_PATH, DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, and + standard system library paths. For convenience, this is constructed as a dictionary where the keys are the library paths and the values are the names of the libraries @@ -90,14 +92,14 @@ def libraries_in_ld_library_path(path_hints=None): path_hints (list): list of paths to be searched. If None the list will be constructed based on the set of LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, and DYLD_FALLBACK_LIBRARY_PATH environment - variables. + variables as well as the standard system library paths. """ - path_hints = path_hints or spack.util.environment.get_path( - "LIBRARY_PATH" - ) + spack.util.environment.get_path("LD_LIBRARY_PATH") + spack.util.environment.get_path( - "DYLD_LIBRARY_PATH" - ) + spack.util.environment.get_path( - "DYLD_FALLBACK_LIBRARY_PATH" + path_hints = ( + path_hints + or spack.util.environment.get_path("LD_LIBRARY_PATH") + + spack.util.environment.get_path("DYLD_LIBRARY_PATH") + + spack.util.environment.get_path("DYLD_FALLBACK_LIBRARY_PATH") + + spack.util.ld_so_conf.host_dynamic_linker_search_paths() ) search_paths = llnl.util.filesystem.search_paths_for_libraries(*path_hints) @@ -129,14 +131,17 @@ def by_library(packages_to_check, path_hints=None): # Other libraries could use the strings function to extract it as described # in https://unix.stackexchange.com/questions/58846/viewing-linux-library-executable-version-info """Return the list of packages that have been detected on the system, - searching by LD_LIBRARY_PATH. + searching by LD_LIBRARY_PATH, LIBRARY_PATH, DYLD_LIBRARY_PATH, + DYLD_FALLBACK_LIBRARY_PATH, and standard system library paths. Args: packages_to_check (list): list of packages to be detected path_hints (list): list of paths to be searched. If None the list will be - constructed based on the LD_LIBRARY_PATH environment variable. + constructed based on the LD_LIBRARY_PATH, LIBRARY_PATH, + DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH environment variables + and standard system library paths. """ - path_to_lib_name = libraries_in_ld_library_path(path_hints=path_hints) + path_to_lib_name = libraries_in_ld_and_system_library_path(path_hints=path_hints) lib_pattern_to_pkgs = collections.defaultdict(list) for pkg in packages_to_check: if hasattr(pkg, "libraries"): |