diff options
author | Peter Scheibel <scheibel1@llnl.gov> | 2019-02-15 17:21:35 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-15 17:21:35 -0600 |
commit | 32ba47181606db1727ecb05effdcda39bc3e7584 (patch) | |
tree | 02adc00048f625560b0efbb93f1afa7f4aef1ec5 | |
parent | 9b1690641b5f0d54acba31e88b5095194ed5317c (diff) | |
download | spack-32ba47181606db1727ecb05effdcda39bc3e7584.tar.gz spack-32ba47181606db1727ecb05effdcda39bc3e7584.tar.bz2 spack-32ba47181606db1727ecb05effdcda39bc3e7584.tar.xz spack-32ba47181606db1727ecb05effdcda39bc3e7584.zip |
Dependency libs: filter system paths and always add lib dir (#10622)
Fixes #10617
Fixes #10624
Closes: #10619
#8136 dependended entirely on spec.libs to retrieve library directories
from dependencies. By default this function only retrieves libraries if
their name is something like lib<package> (e.g. "libfoo.so" for a
package called "Foo"). This unconditionally adds lib/lib64 directories
for each dependency as link/rpath directories.
This also filters system paths from link/rpaths/include directories and
removes duplicated paths that #8136 could add.
-rw-r--r-- | lib/spack/spack/build_environment.py | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 4208def724..ae93d10d7b 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -45,6 +45,7 @@ from six import StringIO import llnl.util.tty as tty from llnl.util.tty.color import cescape, colorize from llnl.util.filesystem import mkdirp, install, install_tree +from llnl.util.lang import dedupe import spack.build_systems.cmake import spack.build_systems.meson @@ -275,18 +276,22 @@ def set_build_environment_variables(pkg, env, dirty): for dep in link_deps: if is_system_path(dep.prefix): continue - # TODO: packages with alternative implementations of .libs which - # are external may place libraries in nonstandard directories, so - # there should be a check for that query = pkg.spec[dep.name] + dep_link_dirs = list() try: - dep_link_dirs = list(query.libs.directories) - link_dirs.extend(dep_link_dirs) - if dep in rpath_deps: - rpath_dirs.extend(dep_link_dirs) + dep_link_dirs.extend(query.libs.directories) except spack.spec.NoLibrariesError: tty.debug("No libraries found for {0}".format(dep.name)) + for default_lib_dir in ['lib', 'lib64']: + default_lib_prefix = os.path.join(dep.prefix, default_lib_dir) + if os.path.isdir(default_lib_prefix): + dep_link_dirs.append(default_lib_prefix) + + link_dirs.extend(dep_link_dirs) + if dep in rpath_deps: + rpath_dirs.extend(dep_link_dirs) + # TODO: fix the line below, currently the logic is broken for # TODO: packages that uses directories as namespaces e.g. # TODO: #include <boost/xxx.hpp> @@ -295,6 +300,10 @@ def set_build_environment_variables(pkg, env, dirty): if os.path.isdir(dep.prefix.include): include_dirs.append(dep.prefix.include) + link_dirs = list(dedupe(filter_system_paths(link_dirs))) + include_dirs = list(dedupe(filter_system_paths(include_dirs))) + rpath_dirs = list(dedupe(filter_system_paths(rpath_dirs))) + env.set(SPACK_LINK_DIRS, ':'.join(link_dirs)) env.set(SPACK_INCLUDE_DIRS, ':'.join(include_dirs)) env.set(SPACK_RPATH_DIRS, ':'.join(rpath_dirs)) |