ldd is one of the key tools that should be familiar to all programmers. It shows the list of all shared libraries that an executable binary depends on.
A binary, say ELF file, lists only the immediate shared libraries it depends on in its header. Each of these shared libraries could further depend on other libraries and so on. It would be very useful if you could see the hierarchical tree of these dependencies between the shared libraries. Thankfully, there is a tool that does exactly that named lddtree.
- It can be installed easily:
$ sudo apt install pax-utils
- Usage is straightforward:
$ lddtree foo
- By default, the tool does not show duplicated dependencies. That is, the dependency between a library A and B is shown only once and skipped after that, though it may occur many times. To view all the dependencies, including duplicates:
$ lddtree -a foo
Beware that this can result in a very big tree! This is because dependencies like
ld-linux loader and such will appear for almost all shared libraries.
Note: The Dependency Walker tool does something similar on Windows and can be used as described here.
Tried with: PaX-Utils 0.2.3 and Ubuntu 14.04