On Sun, 27 Sep 2015 08:31:47 -0300
Fernando de Oliveira <[email protected]> wrote:

> Got from ldd, grepping libattr, only for /usr/{,s}bin:

{/usr,}/{s,}bin

Be careful when using LDD. It will expand the libraries as in the following 
example:

ldd /bin/ls
        linux-hellokitty.so.1 (0x00007ffec5daa000)
        libcap.so.2 => /lib/libcap.so.2 (0x00007f1d2822d000)
        libacl.so.1 => /lib/libacl.so.1 (0x00007f1d28025000)
        libc.so.6 => /lib/libc.so.6 (0x00007f1d27c57000)
        libattr.so.1 => /lib/libattr.so.1 (0x00007f1d27a53000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1d28431000)

readelf -d /bin/ls | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libcap.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libacl.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

Because libacl and libcap needs libattr, ldd will expose that.

Use the following script which Armin provided a long time ago:

#!/bin/sh

if [ ! $1 ]; then
  /bin/echo -e "this script requires one arguments."
  exit 1
fi

rm -f ${PWD}/check

find {,/usr}/{bin,lib,sbin} -type f ! -path "*/debug/*" ! -path "*/java/*" ! 
-path "*/syslinux/*" ! -path "*/vmware*/*" 2>/dev/null | while read 
BUILD_BINARY ; do
case "$(file -bi "${BUILD_BINARY}")" in
*application/x-sharedlib* | *application/x-executable*)
  readelf -d ${BUILD_BINARY} | grep "NEEDED" | grep $1 > /dev/null
  if [ $? -eq 0 ]; then
    /bin/echo ${BUILD_BINARY} >> ${PWD}/check
  fi
esac
done

Sincerely,

William Harrington
-- 
William Harrington <[email protected]>
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to