November 10, 2009

Use objdump to do library depency check

Generally, things that are trying to determine shared library
dependencies should use something like objdump, not ldd:

objdump -p $f | awk '/ NEEDED / { print $2 }'

5 comments:

  1. because many times it is necessary to find out the depending libraries of an executable but ldd is not available. This happens a lot on embedded systems that runs Linux.

    ReplyDelete
  2. Cool thanks for the tip

    ReplyDelete
  3. Also, on x86, ldd attempt to actually run the application. If this cannot happen (e.g. because you attempt to run a 32-bit app on a 64-bit Linux and no 32-bit compatibility is present), you don't get output at all.

    ReplyDelete
  4. Very helpful, works as ldd replacement with my MIPS toolchain

    ReplyDelete