Skip to content

Instantly share code, notes, and snippets.

@CoRfr
Created January 18, 2019 22:33
Show Gist options
  • Select an option

  • Save CoRfr/79596dbbc65b588df94f7a51810c070c to your computer and use it in GitHub Desktop.

Select an option

Save CoRfr/79596dbbc65b588df94f7a51810c070c to your computer and use it in GitHub Desktop.
Find all lib dependencies of a sub-dir that are not contained in that dir
#!/bin/bash
dir=$1
for file in $(find "$dir" -name "lib*.so" -or -wholename "*/bin/*"); do
objdump -x $file 2>/dev/null | grep NEEDED
done | sort -u | awk '{print $2}' > /tmp/all-libs
while read -r -u 10 lib; do
( find "$dir" -name "$lib" -print0 | grep -qz . ) || echo "$lib"
done 10</tmp/all-libs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment