From 9be4763d54ed541a372783b9a1fc21366a88d586 Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Thu, 20 Feb 2025 11:52:58 +0100 Subject: [PATCH 1/9] Introduce 'check_readelf_rpath' variable to optionally skip RPATH checks This commit adds a new easyconfig variable named 'check_readelf_rpath'. When set, RPATH checks are skipped even if the --rpath flag is present. This provides more flexible control over RPATH validation in specialized build scenarios (as git-lfs). --- easybuild/framework/easyblock.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 21a85f21a0..2af67cdefd 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -3130,6 +3130,11 @@ def _sanity_check_step_multi_deps(self, *args, **kwargs): def sanity_check_rpath(self, rpath_dirs=None, check_readelf_rpath=True): """Sanity check binaries/libraries w.r.t. RPATH linking.""" + if self.cfg.get('check_readelf_rpath') is False: + self.log.info( + "RPATH checking is disabled due to the easyconfig setting 'check_readelf_rpath=False' ... skipping" + ) + return [] self.log.info("Checking RPATH linkage for binaries/libraries...") fails = [] From 0d7a55ccf3cb13b05d5d036413fe17c2dc96363b Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Thu, 20 Feb 2025 13:22:20 +0100 Subject: [PATCH 2/9] Update default.py - add 'check_readelf_rpath' variable --- easybuild/framework/easyconfig/default.py | 1 + 1 file changed, 1 insertion(+) diff --git a/easybuild/framework/easyconfig/default.py b/easybuild/framework/easyconfig/default.py index 7c1b5acaba..881779e777 100644 --- a/easybuild/framework/easyconfig/default.py +++ b/easybuild/framework/easyconfig/default.py @@ -233,6 +233,7 @@ "and will be archived in the next major release of EasyBuild", OTHER], 'build_info_msg': [None, "String with information to be printed to stdout and logged during the building " "of the easyconfig", OTHER], + 'check_readelf_rpath': [None, "If False, it won't check the RPATH even with the --rpath flag", OTHER], } From cbf17a4e6ace7ba4f95f46fae2a14c139dbf2b9a Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Thu, 20 Feb 2025 18:53:56 +0100 Subject: [PATCH 3/9] Update easyblock.py - update check_readelf_rpath --- easybuild/framework/easyblock.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 2af67cdefd..1d276d69b9 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -3130,15 +3130,19 @@ def _sanity_check_step_multi_deps(self, *args, **kwargs): def sanity_check_rpath(self, rpath_dirs=None, check_readelf_rpath=True): """Sanity check binaries/libraries w.r.t. RPATH linking.""" - if self.cfg.get('check_readelf_rpath') is False: - self.log.info( - "RPATH checking is disabled due to the easyconfig setting 'check_readelf_rpath=False' ... skipping" - ) - return [] self.log.info("Checking RPATH linkage for binaries/libraries...") fails = [] + # Configure RPATH checking by readelf using easyconfig variable 'check_readelf_rpath' (default True) + if check_readelf_rpath is None: + check_readelf_rpath = self.cfg["check_readelf_rpath"] + ( + self.log.info("RPATH checking by readelf is enabled") + if check_readelf_rpath + else self.log.info("RPATH checking by readelf is disabled") + ) + # hard reset $LD_LIBRARY_PATH before running RPATH sanity check orig_env = env.unset_env_vars(['LD_LIBRARY_PATH']) From 2c84362ee52c7ce17ac87ab8ff0de003f628e9d9 Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Thu, 20 Feb 2025 18:55:43 +0100 Subject: [PATCH 4/9] Update default.py - check_readelf_rpath default is True --- easybuild/framework/easyconfig/default.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/framework/easyconfig/default.py b/easybuild/framework/easyconfig/default.py index 881779e777..ca8e01fc33 100644 --- a/easybuild/framework/easyconfig/default.py +++ b/easybuild/framework/easyconfig/default.py @@ -233,7 +233,7 @@ "and will be archived in the next major release of EasyBuild", OTHER], 'build_info_msg': [None, "String with information to be printed to stdout and logged during the building " "of the easyconfig", OTHER], - 'check_readelf_rpath': [None, "If False, it won't check the RPATH even with the --rpath flag", OTHER], + 'check_readelf_rpath': [True, "If False, it won't check the RPATH by readelf even with the --rpath flag", OTHER], } From 4d9c309aee17e083924af446bcf157dd4ffdc697 Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Thu, 20 Feb 2025 19:03:31 +0100 Subject: [PATCH 5/9] Update easyblock.py - set check_readelf_rpath default to None --- easybuild/framework/easyblock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 1d276d69b9..79c79bb98e 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -3127,7 +3127,7 @@ def _sanity_check_step_multi_deps(self, *args, **kwargs): self.cfg['builddependencies'] = builddeps self.cfg.iterating = False - def sanity_check_rpath(self, rpath_dirs=None, check_readelf_rpath=True): + def sanity_check_rpath(self, rpath_dirs=None, check_readelf_rpath=None): """Sanity check binaries/libraries w.r.t. RPATH linking.""" self.log.info("Checking RPATH linkage for binaries/libraries...") From 491414f2b471dab4d79718b548441d04ae6bb304 Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Fri, 28 Feb 2025 17:35:17 +0100 Subject: [PATCH 6/9] Update toy_build.py - add check_readelf_rpath test to test_toy_rpath --- test/framework/toy_build.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index 5219ee5aa6..e136f3c9d8 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -2837,6 +2837,14 @@ def grab_gcc_rpath_wrapper_args(): write_file(toy_ec, toy_ec_txt) self.test_toy_build(ec_file=toy_ec, extra_args=['--rpath'], raise_error=True) + # test check_readelf_rpath easyconfig parameter + test_ecs = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs') + toy_ec_txt = read_file(os.path.join(test_ecs, 't', 'toy', 'toy-0.0.eb')) + toy_ec_txt += "\ncheck_readelf_rpath = False\n" + toy_ec = os.path.join(self.test_prefix, 'toy.eb') + write_file(toy_ec, toy_ec_txt) + self.test_toy_build(ec_file=toy_ec, extra_args=['--rpath'], raise_error=True) + def test_toy_filter_rpath_sanity_libs(self): """Test use of --filter-rpath-sanity-libs.""" From 42c8166f6327676582b299d1e4a1136699f51d44 Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Fri, 28 Feb 2025 17:39:12 +0100 Subject: [PATCH 7/9] Update toy_build.py - fix whitespace --- test/framework/toy_build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index e136f3c9d8..7d483559da 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -2837,7 +2837,7 @@ def grab_gcc_rpath_wrapper_args(): write_file(toy_ec, toy_ec_txt) self.test_toy_build(ec_file=toy_ec, extra_args=['--rpath'], raise_error=True) - # test check_readelf_rpath easyconfig parameter + # test check_readelf_rpath easyconfig parameter test_ecs = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs') toy_ec_txt = read_file(os.path.join(test_ecs, 't', 'toy', 'toy-0.0.eb')) toy_ec_txt += "\ncheck_readelf_rpath = False\n" From 5a802edfb81d0b8180de2dc0f7f62686b037ff72 Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Thu, 10 Apr 2025 18:56:27 +0200 Subject: [PATCH 8/9] Update toy_build.py - sync with eb5 changes --- test/framework/toy_build.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index 7d5ab9e638..180db68a2f 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -3032,7 +3032,8 @@ def grab_gcc_rpath_wrapper_args(): toy_ec_txt += "\ncheck_readelf_rpath = False\n" toy_ec = os.path.join(self.test_prefix, 'toy.eb') write_file(toy_ec, toy_ec_txt) - self.test_toy_build(ec_file=toy_ec, extra_args=['--rpath'], raise_error=True) + with self.mocked_stdout_stderr(): + self._test_toy_build(ec_file=toy_ec, extra_args=['--rpath'], raise_error=True) def test_toy_filter_rpath_sanity_libs(self): """Test use of --filter-rpath-sanity-libs.""" From 7ba614afe74e5e251e515e5b7fd68bec7d11f054 Mon Sep 17 00:00:00 2001 From: Pavel Tomanek <99190809+pavelToman@users.noreply.github.com> Date: Thu, 10 Apr 2025 19:00:19 +0200 Subject: [PATCH 9/9] Update toy_build.py - fix indent --- test/framework/toy_build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/framework/toy_build.py b/test/framework/toy_build.py index 180db68a2f..28f3139277 100644 --- a/test/framework/toy_build.py +++ b/test/framework/toy_build.py @@ -3033,7 +3033,7 @@ def grab_gcc_rpath_wrapper_args(): toy_ec = os.path.join(self.test_prefix, 'toy.eb') write_file(toy_ec, toy_ec_txt) with self.mocked_stdout_stderr(): - self._test_toy_build(ec_file=toy_ec, extra_args=['--rpath'], raise_error=True) + self._test_toy_build(ec_file=toy_ec, extra_args=['--rpath'], raise_error=True) def test_toy_filter_rpath_sanity_libs(self): """Test use of --filter-rpath-sanity-libs."""