diff --git a/eb_hooks.py b/eb_hooks.py index 8f21b3c8..720afb29 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -334,8 +334,27 @@ def post_prepare_hook_gcc_prefixed_ld_rpath_wrapper(self, *args, **kwargs): config_guess = obtain_config_guess() system_type, _ = run_cmd(config_guess, log_all=True) cmd_prefix = '%s-' % system_type.strip() + if cmd_prefix.startswith('riscv64-unknown-'): + # The 2025.06 compatibility layer for RISC-V is built with CHOST=riscv64-pc-linux-gnu, + # while config.guess returns riscv64-unknown-linux-gnu. + # If we can't find an ld with the original cmd_prefix, but can find one with the -pc- prefix, + # we simply override the original cmd_prefix. + eprefix = get_eessi_envvar('EPREFIX') + cmd_prefix_riscv_pc = cmd_prefix.replace('-unknown-', '-pc-') + if ( + not os.path.exists(os.path.join(eprefix, 'usr', 'bin', cmd_prefix + 'ld')) and + os.path.exists(os.path.join(eprefix, 'usr', 'bin', cmd_prefix_riscv_pc + 'ld')) + ): + self.log.info(f"Using {cmd_prefix_riscv_pc} instead of {cmd_prefix} as command prefix.") + cmd_prefix = cmd_prefix_riscv_pc for cmd in ('ld', 'ld.gold', 'ld.bfd'): wrapper = which(cmd) + if wrapper is None: + if cmd in ['ld.gold']: + # newer compatibility layers don't have ld.gold + continue + else: + raise EasyBuildError(f"No RPATH wrapper script found for {cmd}.") self.log.info("Path to %s wrapper: %s" % (cmd, wrapper)) wrapper_dir = os.path.dirname(wrapper) prefix_wrapper = os.path.join(wrapper_dir, cmd_prefix + cmd)