libtree is a useful tool to figure out which dynamic libraries a binary executable depends on.
It’s similar to ldd
, but prints a tree view indicating dependency nesting. It also shows how shared libraries have been found.
For example, this is the output for a build of the Crystal compiler (at version 1.11.1, with LLVM 14):
$ libtree .build/crystal
.build/crystal
├── libpcre2-8.so.0 [runpath]
├── libgc.so.1 [runpath]
├── libevent-2.1.so.7 [runpath]
├── libLLVM-14.so.1 [ld.so.conf]
│ ├── libffi.so.8 [ld.so.conf]
│ ├── libtinfo.so.6 [ld.so.conf]
│ ├── libz.so.1 [ld.so.conf]
│ ├── libxml2.so.2 [ld.so.conf]
│ │ ├── libicuuc.so.70 [ld.so.conf]
│ │ │ └── libicudata.so.70 [ld.so.conf]
│ │ ├── liblzma.so.5 [ld.so.conf]
│ │ └── libz.so.1 [ld.so.conf]
│ └── libedit.so.2 [ld.so.conf]
│ ├── libtinfo.so.6 [ld.so.conf]
│ └── libbsd.so.0 [ld.so.conf]
│ └── libmd.so.0 [ld.so.conf]
└── librt.so.1 [ld.so.conf]
via hacker news