#!/bin/bash # set env. export LD_LIBRARY_PATH=$PWD echo " --- Environment variables:" echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" echo " --- Check library dependencies:" SO_FILES=lib*.so* LIBS_CNT=0 LIBS_WITH_NOT_FOUND_DEPS_CNT=0 for f in $SO_FILES do LIBS_CNT=$((LIBS_CNT+1)) LDD_RES=$(ldd $f) if [[ $LDD_RES == *"not found"* ]]; then echo "ldd $f [NOT FOUND ONE OR MORE DEPENDENCIES]" ldd $f LIBS_WITH_NOT_FOUND_DEPS_CNT=$((LIBS_WITH_NOT_FOUND_DEPS_CNT+1)) else echo "ldd $f [OK]" fi done echo " --- Results:" echo "LIBS_CNT $LIBS_CNT" echo "LIBS_WITH_NOT_FOUND_DEPS_CNT $LIBS_WITH_NOT_FOUND_DEPS_CNT"
В результате удачного запуска (все зависимости найдены) будет такое:
[vasya@localhost the_app]$ ./check_so_deps.sh
--- Environment variables:
LD_LIBRARY_PATH=/home/vasya/the_app
--- Check library dependencies:
ldd libc-2.12.so [OK]
ldd libc.so [OK]
ldd libc.so.6 [OK]
ldd libexif.so.12 [OK]
ldd libexif.so.12.3.3 [OK]
ldd libgdiplus.dll.so [OK]
ldd libgdiplus.so.0 [OK]
ldd libgdiplus.so.0.0.0 [OK]
ldd libgif.so.4 [OK]
ldd libgif.so.4.1.6 [OK]
ldd libQtCore.so [OK]
ldd libQtCore.so.4 [OK]
ldd libQtCore.so.4.6 [OK]
ldd libQtCore.so.4.6.2 [OK]
ldd libQtGui.so [OK]
ldd libQtGui.so.4 [OK]
ldd libQtGui.so.4.6 [OK]
ldd libQtGui.so.4.6.2 [OK]
ldd libungif.so.4 [OK]
ldd libungif.so.4.1.6 [OK]
ldd libX11.so [OK]
ldd libX11.so.6 [OK]
ldd libX11.so.6.3.0 [OK]
--- Results:
LIBS_CNT 29
LIBS_WITH_NOT_FOUND_DEPS_CNT 0