Binary caches on MacOS - allow expanded RPATHs (#11345)
Fixes #11335 Update the Spack compiler wrappers to add the headerpad_max_install_names linker flag on MacOS. This allows the install_name_tool to rewrite the RPATH entry of the binary to be longer if needed. This is primarily useful for creating and distributing binary caches of packages (i.e. using the "spack buildcache" command); binary caches created on MacOS before this commit may not successfully relocate (if the target root path is larger).
This commit is contained in:

committed by
Peter Scheibel

parent
328a3f97fd
commit
9a85a7a5aa
11
lib/spack/env/cc
vendored
11
lib/spack/env/cc
vendored
@@ -382,6 +382,17 @@ case "$mode" in
|
||||
flags=("${flags[@]}" "${SPACK_LDFLAGS[@]}") ;;
|
||||
esac
|
||||
|
||||
# On macOS insert headerpad_max_install_names linker flag
|
||||
if [[ ($mode == ld || $mode == ccld) && "$SPACK_SHORT_SPEC" =~ "darwin" ]];
|
||||
then
|
||||
case "$mode" in
|
||||
ld)
|
||||
flags=("${flags[@]}" -headerpad_max_install_names) ;;
|
||||
ccld)
|
||||
flags=("${flags[@]}" -Wl,-headerpad_max_install_names) ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Prepend include directories
|
||||
IFS=':' read -ra include_dirs <<< "$SPACK_INCLUDE_DIRS"
|
||||
if [[ $mode == cpp || $mode == cc || $mode == as || $mode == ccld ]]; then
|
||||
|
Reference in New Issue
Block a user