You are not logged in.
Hi everyone, I made a small script which checks locally installed packages for missing dependencies using ldd.
The script basically gets the list of files contained in local packages and runs ldd on the files to check if dependencies are missing (kinda like findbrokenpkgs or lddd found in "devtools").
However, since it only checks the files of local packages, it's much faster than lddd or findbrokenpkgs which check all packages.
The aur package is called aurebuildcheck-git and can be found at https://aur.archlinux.org/packages/aurebuildcheck-git/ .
Have fun.
Offline
runs ldd on the files
ldd is the wrong tool to use. As a contrived example, suppose libcairo has a soname bump and you have a locally built version of gvim. Your tool is going to tell you that gvim needs a rebuild. This is wrong -- gvim links to libgtk, not libcairo. But, because ldd leverages the linker to do full recursive resolution, gvim is going to be pointed out as a suspect.
Use objdump or readelf to read the DT_NEEDED sections of ELF binaries and search for *those* dependencies being broken.
Offline
Ok, thank you!
It's a bit more hacky now, and a bit slower.
localpackages=`pacman -Qqm`
localpackagesamount=`echo $localpackages | wc -w`
echo -e "${localpackagesamount} packages will be checked...\n"
brokenpkgs=""
localpackages=`pacman -Qqm`
for package in $localpackages ; do
BROKEN="false"
echo "checking ${package}..."
packagefiles=`pacman -Qql $package | grep -v "\.a\|\.png\|\.la\|\.ttf\|\.gz\|\.html\|\.css\|\.h\|\.xml\|\.rgb\|\.gif\|\.wav\|\.ogg\|\.mp3\|\.po\|\.txt\|\.jpg\|\.jpeg"`
IFS=$'\n'
for file in $packagefiles; do
if (( $(file $file | grep -c 'ELF') != 0 )); then
# Is an ELF binary.
libs=`readelf -d "${file}" | grep "NEEDED.*\[.*\]" | awk '{print $5}' | sed -e "s/\[//" -e "s/\]//"`
for lib in ${libs} ; do
# needed libs
if [ -z `whereis ${lib} | awk '{print $2}'` ] ; then
# Missing lib.
echo -e "\t ${RED}${file}${NC} needs ${REDUL}$lib${NC}" # >> $TEMPDIR/raw.txt
BROKEN="true" # to avoid packages being listed in the brokenpkg array several times
fi
done
fi
done
if [[ ${BROKEN} == "true" ]] ; then
brokenpkgs="${brokenpkgs} ${package}"
fi
done
Offline