Skip to content

Commit 47091c1

Browse files
authored
Merge pull request #4249 from bedroge/make_rpath_readelf_check_optional
make the RPATH section check with `readelf -d` in sanity check optional
2 parents b1a5287 + ab9975d commit 47091c1

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

easybuild/framework/easyblock.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,7 +3087,7 @@ def _sanity_check_step_multi_deps(self, *args, **kwargs):
30873087
self.cfg['builddependencies'] = builddeps
30883088
self.cfg.iterating = False
30893089

3090-
def sanity_check_rpath(self, rpath_dirs=None):
3090+
def sanity_check_rpath(self, rpath_dirs=None, check_readelf_rpath=True):
30913091
"""Sanity check binaries/libraries w.r.t. RPATH linking."""
30923092

30933093
self.log.info("Checking RPATH linkage for binaries/libraries...")
@@ -3152,17 +3152,21 @@ def sanity_check_rpath(self, rpath_dirs=None):
31523152
self.log.debug("Output of 'ldd %s' checked, looks OK", path)
31533153

31543154
# check whether RPATH section in 'readelf -d' output is there
3155-
out, ec = run_cmd("readelf -d %s" % path, simple=False, trace=False)
3156-
if ec:
3157-
fail_msg = "Failed to run 'readelf %s': %s" % (path, out)
3158-
self.log.warning(fail_msg)
3159-
fails.append(fail_msg)
3160-
elif not readelf_rpath_regex.search(out):
3161-
fail_msg = "No '(RPATH)' found in 'readelf -d' output for %s: %s" % (path, out)
3162-
self.log.warning(fail_msg)
3163-
fails.append(fail_msg)
3155+
if check_readelf_rpath:
3156+
fail_msg = None
3157+
out, ec = run_cmd("readelf -d %s" % path, simple=False, trace=False)
3158+
if ec:
3159+
fail_msg = "Failed to run 'readelf %s': %s" % (path, out)
3160+
elif not readelf_rpath_regex.search(out):
3161+
fail_msg = "No '(RPATH)' found in 'readelf -d' output for %s: %s" % (path, out)
3162+
3163+
if fail_msg:
3164+
self.log.warning(fail_msg)
3165+
fails.append(fail_msg)
3166+
else:
3167+
self.log.debug("Output of 'readelf -d %s' checked, looks OK", path)
31643168
else:
3165-
self.log.debug("Output of 'readelf -d %s' checked, looks OK", path)
3169+
self.log.debug("Skipping the RPATH section check with 'readelf -d', as requested")
31663170
else:
31673171
self.log.debug("Not sanity checking files in non-existing directory %s", dirpath)
31683172

0 commit comments

Comments
 (0)