Skip to content

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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
13 changes: 12 additions & 1 deletion easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3350,13 +3350,24 @@ 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...")

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'])
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 @@ -230,6 +230,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 @@ -3026,6 +3026,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
Loading