Skip to content

add support for check_readelf_rpath easyconfig parameter to optionally skip RPATH checks #4768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 23, 2025
Merged
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
11 changes: 10 additions & 1 deletion easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3734,13 +3734,22 @@ def trace_and_log(msg):

return fail_msgs

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...")

fails = []

if check_readelf_rpath is None:
# Configure RPATH checking by readelf using easyconfig variable 'check_readelf_rpath' (default True)
check_readelf_rpath = self.cfg["check_readelf_rpath"]

if check_readelf_rpath:
self.log.info("Checks on RPATH section of binaries/libraries (via 'readelf -d') enabled")
else:
self.log.info("Checks on RPATH section of binaries/libraries (via 'readelf -d') disabled")

if build_option('strict_rpath_sanity_check'):
self.log.info("Unsetting $LD_LIBRARY_PATH since strict RPATH sanity check is enabled...")
# hard reset $LD_LIBRARY_PATH before running RPATH sanity check
Expand Down
1 change: 1 addition & 0 deletions easybuild/framework/easyconfig/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,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': [True, "If False, it won't check the RPATH by readelf even with the --rpath flag", OTHER],
}


Expand Down
9 changes: 9 additions & 0 deletions test/framework/toy_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3035,6 +3035,15 @@ def grab_gcc_rpath_wrapper_args():
with self.mocked_stdout_stderr():
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)
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."""

Expand Down