From c2ec231652a5fe12c0e90e3d9576d6e36ae7fbfa Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 27 May 2023 19:34:35 +0200 Subject: [PATCH] patch copied wrapper script to make sure it's actually working (CMD needs to be set to 'ld' for 'x86_64-pc-linux-gnu-ld', because EasyBuild's rpath_args.py only takes into account 'ld' when determining whether or not to use -Wl,-rpath or just -rpath --- eb_hooks.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/eb_hooks.py b/eb_hooks.py index 9b07ed3b8e..777d583c7b 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -6,7 +6,7 @@ from easybuild.easyblocks.generic.configuremake import obtain_config_guess from easybuild.tools.build_log import EasyBuildError, print_msg from easybuild.tools.config import build_option, update_build_option -from easybuild.tools.filetools import copy_file, which +from easybuild.tools.filetools import apply_regex_substitutions, copy_file, which from easybuild.tools.run import run_cmd from easybuild.tools.systemtools import AARCH64, POWER, X86_64, get_cpu_architecture, get_cpu_features from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC @@ -108,6 +108,17 @@ def gcc_postprepare(self, *args, **kwargs): prefix_wrapper = os.path.join(wrapper_dir, cmd_prefix + cmd) copy_file(wrapper, prefix_wrapper) self.log.info("Path to %s wrapper with '%s' prefix: %s" % (cmd, cmd_prefix, which(prefix_wrapper))) + + # we need to tweak the copied wrapper script, so that: + regex_subs = [ + # - CMD in the script is set to the command name without prefix, because EasyBuild's rpath_args.py + # script that is used by the wrapper script only checks for 'ld', 'ld.gold', etc. + # when checking whether or not to use -Wl + ('^CMD=.*', 'CMD=%s' % cmd), + # - the path to the correct actual binary is logged and called + ('/%s ' % cmd, '/%s ' % (cmd_prefix + cmd)), + ] + apply_regex_substitutions(prefix_wrapper, regex_subs) else: raise EasyBuildError("GCCcore-specific hook triggered for non-GCCcore easyconfig?!")