lddgraph - convert shared object dependencies into a directed graph
lddgraph <dynamically-loadable-file> | dot -Tpng > g.png; eog g.png
lddgraph <ldd-output-file> | dot -Tpng > g.png; eog g.png
cat <ldd-output-file> | lddgraph - | dot -Tpng > g.png; eog g.png
Examine the dynamically loaded executable or shared object file given as an argument, or the output of running ldd -v in a file argument or stdin (with - argument), and emit a graphviz directed graph DOT file on stdout.
The output DOT file may be passed to the 'dot' command to plot it into a displayable format.
ld.so (the Linux ELF loader) will load and relocate every node of the output graph -- all the objects listed at the top of the ldd -v output.
Solid lines are the versioned symbol requirement dependencies.
Dotted lines are direct loader dependencies that weren't pulled in by the more-explicit versioned symbol dependencies.
- read ldd -v output on stdin
-? provide help message
The following:
./lddgraph lddgraph | dot -Tpng -Gsize="800,600" \
-Nfontsize=10 -Efontsize=8 > img/lddgraph.png
Produces output like this:
lddgraph /bin/bash | dot -Tpng > g.png && eog g.png
lddgraph /usr/lib/libgdal.so | dot -Tpng > g.png; eog g.png
ldd -v /bin/uname | lddgraph - | dot -Tpng > g.png; eog g.png
Same issues as ldd has.
ld.so(8), ldconfig(8), ldd(8), dot(1), graphviz(7)
c++ -std=c++98 -o lddgraph lddgraph.cpp
James Perkins, 19 April 2021
MIT
