Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import os
import re

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 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

Expand Down Expand Up @@ -93,6 +96,36 @@ def pre_prepare_hook(self, *args, **kwargs):
mpi_family, rpath_override_dirs)


def gcc_postprepare(self, *args, **kwargs):
"""
Post-configure hook for GCCcore:
- copy RPATH wrapper script for linker commands to also have a wrapper in place with system type prefix like 'x86_64-pc-linux-gnu'
"""
if self.name == 'GCCcore':
config_guess = obtain_config_guess()
system_type, _ = run_cmd(config_guess, log_all=True)
cmd_prefix = '%s-' % system_type.strip()
for cmd in ('ld', 'ld.gold', 'ld.bfd'):
wrapper = which(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)
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?!")

def post_prepare_hook(self, *args, **kwargs):
"""Main post-prepare hook: trigger custom functions."""

Expand All @@ -102,6 +135,9 @@ def post_prepare_hook(self, *args, **kwargs):
print_msg("Resetting rpath_override_dirs to original value: %s", getattr(self, EESSI_RPATH_OVERRIDE_ATTR))
delattr(self, EESSI_RPATH_OVERRIDE_ATTR)

if self.name in POST_PREPARE_HOOKS:
POST_PREPARE_HOOKS[self.name](self, *args, **kwargs)


def cgal_toolchainopts_precise(ec, eprefix):
"""Enable 'precise' rather than 'strict' toolchain option for CGAL on POWER."""
Expand Down Expand Up @@ -220,6 +256,10 @@ def Rust_ver_replace(ec, eprefix):
'UCX': ucx_eprefix,
}

POST_PREPARE_HOOKS = {
'GCCcore': gcc_postprepare,
}

PRE_CONFIGURE_HOOKS = {
'libfabric': libfabric_disable_psm3_x86_64_generic,
'MetaBAT': metabat_preconfigure,
Expand Down
10 changes: 8 additions & 2 deletions eessi-2023.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ easyconfigs:
- GCC-10.3.0.eb:
options:
include-easyblocks-from-pr: 2921
# - GCC-11.3.0.eb
# - GCC-12.2.0.eb
# use Bart Oldeman's update to PR#2921, see https://github.com/trz42/easybuild-easyblocks/pull/1
- GCC-11.3.0.eb:
options:
include-easyblocks-from-pr: '1'
pr-target-account: trz42
# - GCC-12.2.0.eb:
# options:
# include-easyblocks-from-pr: 2921
- OpenSSL-1.1.eb:
options:
include-easyblocks-from-pr: 2922
Expand Down