From dbf16303f902866a85ec6d10c9658431e6747779 Mon Sep 17 00:00:00 2001 From: Richard Top Date: Fri, 14 Aug 2026 13:55:32 +0200 Subject: [PATCH 1/4] Add pre-single-extension hook for hf_xet on aarch64/generic --- eb_hooks.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index 67b031bc..44dd0b80 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1890,6 +1890,23 @@ def pre_single_extension_numpy(ext, *args, **kwargs): update_build_option('optarch', 'march=armv8.2-a') +def pre_single_extension_hf_xet(ext, *args, **kwargs): + """ + Replace -mcpu=generic with -mtune=generic in $CFLAGS, + so that the sha2 asm crate can successfully compile + sha256_aarch64.S with -march=armv8-a+crypto. + see https://github.com/huggingface/xet-core/issues/582 + """ + if ext.name == 'hf_xet': + cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR') + if cpu_target == CPU_TARGET_AARCH64_GENERIC: + cflags = os.getenv('CFLAGS', '') + mcpu_generic = '-mcpu=generic' + if mcpu_generic in cflags: + cflags = cflags.replace(mcpu_generic, '-mtune=generic') + ext.cfg['preinstallopts'] = "export CFLAGS='%s' && " % cflags + + def post_single_extension_numpy(ext, *args, **kwargs): """ Post-extension hook for numpy, to reset 'optarch' build option. @@ -2342,6 +2359,7 @@ def post_easyblock_hook(self, *args, **kwargs): 'isoband': pre_single_extension_isoband, 'numpy': pre_single_extension_numpy, 'testthat': pre_single_extension_testthat, + 'hf_xet': pre_single_extension_hf_xet, } POST_SINGLE_EXTENSION_HOOKS = { From eb03fcf48e279feab422cbdb22b05417ad53772a Mon Sep 17 00:00:00 2001 From: Richard Top Date: Tue, 18 Aug 2026 15:21:05 +0200 Subject: [PATCH 2/4] Replace the hook to meet huggingface/xet-core#582 --- .../2025.06/eessi-2025.06-eb-5.3.0-2024a.yml | 2 ++ eb_hooks.py | 20 ++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 easystacks/software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml diff --git a/easystacks/software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml b/easystacks/software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml new file mode 100644 index 00000000..b13c6a9d --- /dev/null +++ b/easystacks/software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml @@ -0,0 +1,2 @@ +easyconfigs: + - huggingface-hub-0.34.4-GCCcore-13.3.0.eb diff --git a/eb_hooks.py b/eb_hooks.py index 04821769..9ad4c045 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1952,19 +1952,21 @@ def pre_single_extension_numpy(ext, *args, **kwargs): def pre_single_extension_hf_xet(ext, *args, **kwargs): """ - Replace -mcpu=generic with -mtune=generic in $CFLAGS, - so that the sha2 asm crate can successfully compile - sha256_aarch64.S with -march=armv8-a+crypto. - see https://github.com/huggingface/xet-core/issues/582 + Pre-single-extension hook for hf_xet (extension of huggingface-hub) on aarch64/generic: + - inject a sed command into preinstallopts that patches data/Cargo.toml in the hf_xet + source to remove the "asm" feature from the sha2 dependency. + see https://github.com/huggingface/xet-core/issues/582 """ if ext.name == 'hf_xet': cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR') if cpu_target == CPU_TARGET_AARCH64_GENERIC: - cflags = os.getenv('CFLAGS', '') - mcpu_generic = '-mcpu=generic' - if mcpu_generic in cflags: - cflags = cflags.replace(mcpu_generic, '-mtune=generic') - ext.cfg['preinstallopts'] = "export CFLAGS='%s' && " % cflags + sed_cmd = ( + r"""sed -i '/^sha2 = / s/, features = \["asm"\]//' data/Cargo.toml && """ + ) + ext.cfg['preinstallopts'] = sed_cmd + ext.cfg.get('preinstallopts', '') + ext.log.info("Injected data/Cargo.toml sha2 asm patch into preinstallopts for hf_xet on %s", cpu_target) + else: + raise EasyBuildError("hf_xet-specific extension hook triggered for non-hf_xet extension?!") def post_single_extension_numpy(ext, *args, **kwargs): From 31d8c665601d8867d6a94d2bd150e607b90864b7 Mon Sep 17 00:00:00 2001 From: Richard Top Date: Tue, 18 Aug 2026 16:55:59 +0200 Subject: [PATCH 3/4] Added hf_xet versions and hf-xet as extension name --- eb_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eb_hooks.py b/eb_hooks.py index 9ad4c045..3cd66af8 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1957,7 +1957,7 @@ def pre_single_extension_hf_xet(ext, *args, **kwargs): source to remove the "asm" feature from the sha2 dependency. see https://github.com/huggingface/xet-core/issues/582 """ - if ext.name == 'hf_xet': + if ext.name in ['hf_xet', 'hf-xet'] and ext.version in ['1.1.7', '1.2.0']: cpu_target = get_eessi_envvar('EESSI_SOFTWARE_SUBDIR') if cpu_target == CPU_TARGET_AARCH64_GENERIC: sed_cmd = ( From bc26a6d922de720faa6abe4018e78880174df0c2 Mon Sep 17 00:00:00 2001 From: Richard Top Date: Tue, 18 Aug 2026 20:14:09 +0200 Subject: [PATCH 4/4] Removed the easystack file after testing --- .../software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 easystacks/software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml diff --git a/easystacks/software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml b/easystacks/software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml deleted file mode 100644 index b13c6a9d..00000000 --- a/easystacks/software.eessi.io/2025.06/eessi-2025.06-eb-5.3.0-2024a.yml +++ /dev/null @@ -1,2 +0,0 @@ -easyconfigs: - - huggingface-hub-0.34.4-GCCcore-13.3.0.eb