Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to view hierarchy of shared library dependencies using lddtree

📅 2015-Dec-16 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ dependency walker, elf, ldd, lddtree, shared library ⬩ 📚 Archive

Tree of library dependencies shown by lddtree

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.

$ sudo apt install pax-utils
$ lddtree foo
$ lddtree -a foo

Beware that this can result in a very big tree. This is because dependencies like libc, the 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

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧