Skip to content

Commit f5c45bf

Browse files
authored
Merge pull request #141 from bedroge/no_ld.gold_fix
check if `ld` wrappers are actually available in `post_prepare_hook_gcc_prefixed_ld_rpath_wrapper`
2 parents 3e0635a + f627c10 commit f5c45bf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

eb_hooks.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,27 @@ def post_prepare_hook_gcc_prefixed_ld_rpath_wrapper(self, *args, **kwargs):
334334
config_guess = obtain_config_guess()
335335
system_type, _ = run_cmd(config_guess, log_all=True)
336336
cmd_prefix = '%s-' % system_type.strip()
337+
if cmd_prefix.startswith('riscv64-unknown-'):
338+
# The 2025.06 compatibility layer for RISC-V is built with CHOST=riscv64-pc-linux-gnu,
339+
# while config.guess returns riscv64-unknown-linux-gnu.
340+
# If we can't find an ld with the original cmd_prefix, but can find one with the -pc- prefix,
341+
# we simply override the original cmd_prefix.
342+
eprefix = get_eessi_envvar('EPREFIX')
343+
cmd_prefix_riscv_pc = cmd_prefix.replace('-unknown-', '-pc-')
344+
if (
345+
not os.path.exists(os.path.join(eprefix, 'usr', 'bin', cmd_prefix + 'ld')) and
346+
os.path.exists(os.path.join(eprefix, 'usr', 'bin', cmd_prefix_riscv_pc + 'ld'))
347+
):
348+
self.log.info(f"Using {cmd_prefix_riscv_pc} instead of {cmd_prefix} as command prefix.")
349+
cmd_prefix = cmd_prefix_riscv_pc
337350
for cmd in ('ld', 'ld.gold', 'ld.bfd'):
338351
wrapper = which(cmd)
352+
if wrapper is None:
353+
if cmd in ['ld.gold']:
354+
# newer compatibility layers don't have ld.gold
355+
continue
356+
else:
357+
raise EasyBuildError(f"No RPATH wrapper script found for {cmd}.")
339358
self.log.info("Path to %s wrapper: %s" % (cmd, wrapper))
340359
wrapper_dir = os.path.dirname(wrapper)
341360
prefix_wrapper = os.path.join(wrapper_dir, cmd_prefix + cmd)

0 commit comments

Comments
 (0)