diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 38fb3b0e7b..50482137c0 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -3395,6 +3395,14 @@ def sanity_check_rpath(self, rpath_dirs=None, check_readelf_rpath=True): self.log.debug(f"Sanity checking RPATH for files in {dirpath}") for path in [os.path.join(dirpath, x) for x in os.listdir(dirpath)]: + # skip the check for any symlinks that resolve to outside the installation directory + if not is_parent_path(self.installdir, path): + realpath = os.path.realpath(path) + msg = (f"Skipping RPATH sanity check for {path}, since its absolute path {realpath} resolves to" + f" outside the installation directory {self.installdir}") + self.log.info(msg) + continue + self.log.debug(f"Sanity checking RPATH for {path}") out = get_linked_libs_raw(path)