From 45c006b24ea162df2ee152fdb98002c5b08acc14 Mon Sep 17 00:00:00 2001 From: Pablo Escobar Date: Thu, 4 Sep 2025 12:12:03 +0200 Subject: [PATCH 1/3] cmake hook to use ncurses library from EESSI https://github.com/EESSI/software-layer/issues/1175 --- eb_hooks.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index e855d99a..8fe81dc2 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -942,6 +942,19 @@ def pre_configure_hook_LAMMPS_zen4(self, *args, **kwargs): else: raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!") +def pre_configure_hook_cmake_system(self, *args, **kwargs): + """ + pre-configure hook for cmake built with SYSTEM toolchain: + - unset configopts for cmake easyconfigs using the SYSTEM toolchain + - https://github.com/EESSI/software-layer/issues/1175 + """ + + if self.name == 'CMake': + if self.toolchain.name == 'system': + print_msg("Unset configopts to use ncurses library from the EESSI compatibility layer") + self.cfg['configopts'] = '' + else: + raise EasyBuildError("CMake-specific hook triggered for non-CMake easyconfig?!") def pre_test_hook(self, *args, **kwargs): """Main pre-test hook: trigger custom functions based on software name.""" @@ -1484,6 +1497,7 @@ def post_easyblock_hook(self, *args, **kwargs): 'LAMMPS': pre_configure_hook_LAMMPS_zen4, 'Score-P': pre_configure_hook_score_p, 'VSEARCH': pre_configure_hook_vsearch, + 'CMake': pre_configure_hook_cmake_system, } PRE_TEST_HOOKS = { From 265f2bfa394ecb0afeff4ad76793288cf3241322 Mon Sep 17 00:00:00 2001 From: Pablo Escobar Date: Mon, 8 Sep 2025 10:26:10 +0200 Subject: [PATCH 2/3] update log messsages in the cmake hook --- eb_hooks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eb_hooks.py b/eb_hooks.py index 8fe81dc2..c16ab0e6 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -951,8 +951,11 @@ def pre_configure_hook_cmake_system(self, *args, **kwargs): if self.name == 'CMake': if self.toolchain.name == 'system': - print_msg("Unset configopts to use ncurses library from the EESSI compatibility layer") + self.log.info("EESSI hook: unset configopts to build on top of EESSI compatibility layer") + self.log.info("https://github.com/EESSI/software-layer/issues/1175") + self.log.info(f"Current configopts before the EESSI custom hook: {self.cfg['configopts']}") self.cfg['configopts'] = '' + self.log.info(f"Updated configopts after the EESSI custom hook: {self.cfg['configopts']}") else: raise EasyBuildError("CMake-specific hook triggered for non-CMake easyconfig?!") From 2e9c060b6ee069718679aae52dcb889d56635faa Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 11 Sep 2025 11:37:24 +0200 Subject: [PATCH 3/3] only remove -DCURSES_.*_LIBRARY configure options when building CMake with system compiler --- eb_hooks.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/eb_hooks.py b/eb_hooks.py index c16ab0e6..f14e36fb 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -942,23 +942,25 @@ def pre_configure_hook_LAMMPS_zen4(self, *args, **kwargs): else: raise EasyBuildError("LAMMPS-specific hook triggered for non-LAMMPS easyconfig?!") + def pre_configure_hook_cmake_system(self, *args, **kwargs): """ - pre-configure hook for cmake built with SYSTEM toolchain: - - unset configopts for cmake easyconfigs using the SYSTEM toolchain - - https://github.com/EESSI/software-layer/issues/1175 + pre-configure hook for CMake built with SYSTEM toolchain: + - remove configure options that link to ncurses static libraries for CMake with system toolchain; + see also https://github.com/EESSI/software-layer/issues/1175 """ if self.name == 'CMake': - if self.toolchain.name == 'system': - self.log.info("EESSI hook: unset configopts to build on top of EESSI compatibility layer") - self.log.info("https://github.com/EESSI/software-layer/issues/1175") - self.log.info(f"Current configopts before the EESSI custom hook: {self.cfg['configopts']}") - self.cfg['configopts'] = '' - self.log.info(f"Updated configopts after the EESSI custom hook: {self.cfg['configopts']}") + if is_system_toolchain(self.toolchain.name): + self.log.info("Removing configure options that require ncurses static libraries...") + self.log.info(f"Original configopts value: {self.cfg['configopts']}") + regex = re.compile("-DCURSES_[A-Z]+_LIBRARY=\$EBROOTNCURSES/lib/lib[a-z]+\.a") + self.cfg['configopts'] = regex.sub(self.cfg['configopts'], '') + self.log.info(f"Updated configopts value: {self.cfg['configopts']}") else: raise EasyBuildError("CMake-specific hook triggered for non-CMake easyconfig?!") + def pre_test_hook(self, *args, **kwargs): """Main pre-test hook: trigger custom functions based on software name.""" if self.name in PRE_TEST_HOOKS: