zzbulg
Last Updated: February 25, 2016
·
949
· pilt
B55060ad5cc63dc10d828c67ebed1abc

Recursively find missing library packages

find_packages.sh:

set -e

# You may have to run this before:
#sudo apt-get -y install pax-utils apt-file
#apt-file update

find_elfs() {
    scanelf -R -B . | cut -d ' ' -f 2-
}

find_libraries() {
    find_elfs | xargs ldd | grep 'not found' \
    | sed -re 's/^[\t]*(.*) =>.*/\1/' | sort | uniq
}

find_packages() {
    find_libraries | xargs -n 1 apt-file search | sort | uniq
}

find_packages

Usage:

# cd /opt/mysystem
# bash find_packages.sh > packages
# cut -d ':' -f 1 < packages | sort | uniq
gcc-snapshot
lib32gfortran3
lib32gfortran3-dbg
libatlas3gf-base
libblas3gf
libgfortran3
libgfortran3-armel-cross
libgfortran3-armhf-cross
libgfortran3-dbg
libgfortran3-dbg-armel-cross
libgfortran3-dbg-armhf-cross
libhfgfortran3-armel-cross
libhfgfortran3-dbg-armel-cross
libilmbase6
libjasper1
libjpeg-turbo8
libjpeg-turbo8-dbg
liblapack3gf
libopenexr6
libpython2.7
libsfgfortran3-armhf-cross
libsfgfortran3-dbg-armhf-cross
libtiff4
python2.7-dbg
revolution-mkl
Say Thanks
Respond
Filed Under