Handling of failing `ldd` also required in sanity_check_rpath
#4033 for background on ldd failing. For those with RPATH enabled, there is also sanity_check_rpath which also calls ldd: https://github.com/easybuilders/easybuild-framework/blob/develop/easybuild/framework/easyblock.py#L3009
Maxim Masterov in slack saw this when building nodejs-16.15.1-GCCcore-11.3.0.eb
== 2022-08-01 12:10:00,256 easyblock.py:2966 INFO Checking RPATH linkage for binaries/libraries...
== 2022-08-01 12:10:00,256 environment.py:112 INFO Unsetting environment variable LD_LIBRARY_PATH (value: /sw/arch/RHEL8/EB_production/2022/software/Python/3.10.4-GCCcore-11.3.0-bare/lib:/sw/arch/RHEL8/EB_production/2022/software/OpenSSL/1.1/lib:/sw/arch/RHEL8/EB_production/2022/software/libffi/3.4.2-GCCcore-11.3.0/lib64:/sw/arch/RHEL8/EB_production/2022/software/XZ/5.2.5-GCCcore-11.3.0/lib:/sw/arch/RHEL8/EB_production/2022/software/SQLite/3.38.3-GCCcore-11.3.0/lib:/sw/arch/RHEL8/EB_production/2022/software/Tcl/8.6.12-GCCcore-11.3.0/lib:/sw/arch/RHEL8/EB_production/2022/software/libreadline/8.1.2-GCCcore-11.3.0/lib:/sw/arch/RHEL8/EB_production/2022/software/ncurses/6.3-GCCcore-11.3.0/lib:/sw/arch/RHEL8/EB_production/2022/software/bzip2/1.0.8-GCCcore-11.3.0/lib:/sw/arch/RHEL8/EB_production/2022/software/binutils/2.38-GCCcore-11.3.0/lib:/sw/arch/RHEL8/EB_production/2022/software/zlib/1.2.12-GCCcore-11.3.0/lib:/sw/arch/RHEL8/EB_production/2022/software/GCCcore/11.3.0/lib64)
== 2022-08-01 12:10:00,358 easyblock.py:2985 INFO Using default subdirectories for binaries/libraries to verify RPATH linking: ('bin', 'lib', 'lib64')
== 2022-08-01 12:10:00,359 run.py:233 INFO running cmd: file /home/maximm/.local/easybuild/RHEL8/2022/software/nodejs/16.15.1-GCCcore-11.3.0/bin/node
== 2022-08-01 12:10:00,382 run.py:233 INFO running cmd: ldd /home/maximm/.local/easybuild/RHEL8/2022/software/nodejs/16.15.1-GCCcore-11.3.0/bin/node
== 2022-08-01 12:10:00,413 build_log.py:169 ERROR EasyBuild crashed with an error (at easybuild/base/exceptions.py:124 in __init__): cmd "ldd /home/maximm/.local/easybuild/RHEL8/2022/software/nodejs/16.15.1-GCCcore-11.3.0/bin/node" exited with exit code 1 and output:
not a dynamic executable
But i don't really know how we want to handle it. Just give a warning here and proceed?
The cleanest way is probably to introduce a separate function for the duplicate code we have in check_linked_shared_libs and sanity_check_rpath, which returns the ldd output (or None if the path is not dynamically linked).
Fix implemented in #4051