Skip to content

Commit

Permalink
Merge pull request #4249 from bedroge/make_rpath_readelf_check_optional
Browse files Browse the repository at this point in the history
make the RPATH section check with `readelf -d` in sanity check optional
  • Loading branch information
boegel committed May 23, 2023
2 parents b1a5287 + ab9975d commit 47091c1
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -3087,7 +3087,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):
def sanity_check_rpath(self, rpath_dirs=None, check_readelf_rpath=True):
"""Sanity check binaries/libraries w.r.t. RPATH linking."""

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

# check whether RPATH section in 'readelf -d' output is there
out, ec = run_cmd("readelf -d %s" % path, simple=False, trace=False)
if ec:
fail_msg = "Failed to run 'readelf %s': %s" % (path, out)
self.log.warning(fail_msg)
fails.append(fail_msg)
elif not readelf_rpath_regex.search(out):
fail_msg = "No '(RPATH)' found in 'readelf -d' output for %s: %s" % (path, out)
self.log.warning(fail_msg)
fails.append(fail_msg)
if check_readelf_rpath:
fail_msg = None
out, ec = run_cmd("readelf -d %s" % path, simple=False, trace=False)
if ec:
fail_msg = "Failed to run 'readelf %s': %s" % (path, out)
elif not readelf_rpath_regex.search(out):
fail_msg = "No '(RPATH)' found in 'readelf -d' output for %s: %s" % (path, out)

if fail_msg:
self.log.warning(fail_msg)
fails.append(fail_msg)
else:
self.log.debug("Output of 'readelf -d %s' checked, looks OK", path)
else:
self.log.debug("Output of 'readelf -d %s' checked, looks OK", path)
self.log.debug("Skipping the RPATH section check with 'readelf -d', as requested")
else:
self.log.debug("Not sanity checking files in non-existing directory %s", dirpath)

Expand Down

0 comments on commit 47091c1

Please sign in to comment.