From f35b8b8db42332a93168e3f8a707442186359a6c Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 19 Jan 2015 14:05:48 -0800 Subject: Better location error output. --- lib/spack/spack/cmd/location.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py index 509c336b69..e422eaf966 100644 --- a/lib/spack/spack/cmd/location.py +++ b/lib/spack/spack/cmd/location.py @@ -23,6 +23,7 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import os +import sys from external import argparse import llnl.util.tty as tty @@ -86,11 +87,12 @@ def location(parser, args): tty.die("Spec '%s' matches no installed packages." % spec) elif len(matching_specs) > 1: - args = ["%s matches multiple packages." % spec, - "Matching packages:"] - args += [" " + str(s) for s in matching_specs] - args += ["Use a more specific spec."] - tty.die(*args) + tty.error("%s matches multiple packages:" % spec) + for s in matching_specs: + sys.stderr.write(s.tree(color=True)) + sys.stderr.write("\n") + sys.stderr.write("Use a more specific spec.\n") + sys.exit(1) print matching_specs[0].prefix -- cgit v1.2.3-60-g2f50 From 51ed0d3f6f3ba8cf3c7a17db967aead0b691e3a4 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Mon, 19 Jan 2015 20:59:23 -0800 Subject: Properly set install RPATHS for cmake builds. --- lib/spack/spack/build_environment.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 45353ec640..70b5c89411 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -183,6 +183,10 @@ def set_module_variables_for_package(pkg): if platform.mac_ver()[0]: m.std_cmake_args.append('-DCMAKE_FIND_FRAMEWORK=LAST') + # Set up CMake rpath + m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE') + m.std_cmake_args.append('-DCMAKE_INSTALL_RPATH=%s' % ":".join(get_rpaths(pkg))) + # Emulate some shell commands for convenience m.pwd = os.getcwd m.cd = os.chdir @@ -202,6 +206,16 @@ def set_module_variables_for_package(pkg): m.prefix = pkg.prefix +def get_rpaths(pkg): + """Get a list of all the rpaths for a package.""" + rpaths = [pkg.prefix.lib, pkg.prefix.lib64] + rpaths.extend(d.prefix.lib for d in pkg.spec.traverse(root=False) + if os.path.isdir(d.prefix.lib)) + rpaths.extend(d.prefix.lib64 for d in pkg.spec.traverse(root=False) + if os.path.isdir(d.prefix.lib64)) + return rpaths + + def setup_package(pkg): """Execute all environment setup routines.""" set_compiler_environment_variables(pkg) -- cgit v1.2.3-60-g2f50