From b29eb4212e8d9077e0c01911c5448a5900210954 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 23 Oct 2019 22:22:24 +0200 Subject: Users can configure use of RPATH or RUNPATH (#9168) Add a new entry in `config.yaml`: config: shared_linking: 'rpath' If this variable is set to `rpath` (the default) Spack will set RPATH in ELF binaries. If set to `runpath` it will set RUNPATH. Details: * Spack cc wrapper explicitly adds `--disable-new-dtags` when linking * cc wrapper also strips `--enable-new-dtags` from the compile line when disabling (and vice versa) * We specifically do *not* add any dtags flags on macOS, which uses Mach-O binaries, not ELF, so there's no RUNPATH) --- lib/spack/docs/config_yaml.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/spack/docs/config_yaml.rst') diff --git a/lib/spack/docs/config_yaml.rst b/lib/spack/docs/config_yaml.rst index 525f829c9e..d8d07b505a 100644 --- a/lib/spack/docs/config_yaml.rst +++ b/lib/spack/docs/config_yaml.rst @@ -226,3 +226,24 @@ ccache`` to learn more about the default settings and how to change them). Please note that we currently disable ccache's ``hash_dir`` feature to avoid an issue with the stage directory (see https://github.com/LLNL/spack/pull/3761#issuecomment-294352232). + +------------------ +``shared_linking`` +------------------ + +Control whether Spack embeds ``RPATH`` or ``RUNPATH`` attributes in ELF binaries +so that they can find their dependencies. Has no effect on macOS. +Two options are allowed: + + 1. ``rpath`` uses ``RPATH`` and forces the ``--disable-new-tags`` flag to be passed to the linker + 2. ``runpath`` uses ``RUNPATH`` and forces the ``--enable-new-tags`` flag to be passed to the linker + +``RPATH`` search paths have higher precedence than ``LD_LIBRARY_PATH`` +and ld.so will search for libraries in transitive ``RPATHs`` of +parent objects. + +``RUNPATH`` search paths have lower precedence than ``LD_LIBRARY_PATH``, +and ld.so will ONLY search for dependencies in the ``RUNPATH`` of +the loading object. + +DO NOT MIX the two options within the same install tree. -- cgit v1.2.3-60-g2f50