5757 pass
5858
5959from easybuild .base import fancylogger
60- from easybuild .tools .build_log import EasyBuildError
60+ from easybuild .tools .build_log import EasyBuildError , print_warning
6161from easybuild .tools .filetools import is_readable , read_file , which
6262from easybuild .tools .py2vs3 import OrderedDict , string_type
6363from easybuild .tools .run import run_cmd
@@ -970,7 +970,10 @@ def check_linked_shared_libs(path, required_patterns=None, banned_patterns=None)
970970 # example output for shared libraries:
971971 # /lib64/libc-2.17.so: ELF 64-bit LSB shared object, x86-64, ..., dynamically linked (uses shared libs), ...
972972 if "dynamically linked" in file_cmd_out :
973- linked_libs_out , _ = run_cmd ("ldd %s" % path , simple = False , trace = False )
973+ # determine linked libraries via 'ldd', but take into account that 'ldd' may fail for strange reasons,
974+ # like printing 'not a dynamic executable' when not enough memory is available
975+ # (see also https://bugzilla.redhat.com/show_bug.cgi?id=1817111)
976+ linked_libs_cmd = "ldd %s" % path
974977 else :
975978 return None
976979
@@ -981,12 +984,19 @@ def check_linked_shared_libs(path, required_patterns=None, banned_patterns=None)
981984 # /usr/lib/libz.dylib: Mach-O 64-bit dynamically linked shared library x86_64
982985 bin_lib_regex = re .compile ('(Mach-O .* executable)|(dynamically linked)' , re .M )
983986 if bin_lib_regex .search (file_cmd_out ):
984- linked_libs_out , _ = run_cmd ( "otool -L %s" % path , simple = False , trace = False )
987+ linked_libs_cmd = "otool -L %s" % path
985988 else :
986989 return None
987990 else :
988991 raise EasyBuildError ("Unknown OS type: %s" , os_type )
989992
993+ out , ec = run_cmd (linked_libs_cmd , simple = False , trace = False , log_ok = False , log_all = False )
994+ if ec == 0 :
995+ linked_libs_out = out
996+ else :
997+ print_warning ("Determining linked libraries for %s via '%s' failed! Output: '%s'" , path , linked_libs_cmd , out )
998+ return None
999+
9901000 found_banned_patterns = []
9911001 missing_required_patterns = []
9921002 for regex in required_regexs :
0 commit comments