3 ms·
https://github.com/gentoo/pax-utils/blob/master/lddtree.py https://github.com/gentoo/pax-utils/blob/master/lddtree.py already does this. Cool to see though, ver
by totony 5y ago
https://github.com/gentoo/pax-utils/blob/master/lddtree.py https://github.com/gentoo/pax-utils/blob/master/lddtree.py already does this. Cool to see though, very useful
- jedbrown 5y agolddtree is much faster, but libtree has more detailed info.
- stabbles 5y agoIf you want something fast, note that (https://github.com/haampie/libtree-in-c https://github.com/haampie/libtree-in-c) is currently faster than ldd: libtree-in-c $ make CC=musl-gcc CFLAGS="-Os -s -static" musl-gcc -Os -s -static -c libtree.c musl-gcc -Os -s -static -o libtree libtree.o libtree-in-c $ hyperfine 'ldd libLLVM.so' './libtree ./libLLVM.so' Benchmark #1: ldd libLLVM.so Time (mean ± σ): 6.1 ms ± 0.3 ms [User: 5.2 ms, System: 1.2 ms] Range (min … max): 5.3 ms … 8.1 ms 348 runs Benchmark #2: ./libtree ./libLLVM.so Time (mean ± σ): 2.4 ms ± 0.4 ms [User: 1.2 ms, System: 1.2 ms] Range (min … max): 1.7 ms … 3.4 ms 840 runs Warning: Command took less than 5 ms to complete. Results might be inaccurate. Summary './libtree ./libLLVM.so' ran 2.54 ± 0.43 times faster than 'ldd libLLVM.so'
- stabbles 5y agoThe C rewrite was released in libtree 3.0.0
- rwmj 5y agoOr even more basic: $ eu-readelf -d /bin/ls | grep NEEDED NEEDED Shared library: [libselinux.so.1] NEEDED Shared library: [libcap.so.2] NEEDED Shared library: [libc.so.6] Of course the trick is doing it recursively and having nice output.
- IshKebab 5y agoThat's not the same. ldd actually finds the libraries and their dependencies.
- rwmj 5y agoOf course. I'm just pointing out how the source data is encoded in the ELF file. As I said in the comment there is much value in the tools that take this data and the locations of the libraries and build up a nice tree.
- IshKebab 5y agoIt's not though, an ELF file only lists its immediate dependencies. To find the complete tree you actually need to find the dependencies and parse those, which is exactly what this does.
- deleted 5y ago[deleted]
- zvr 5y agoAnd https://github.com/ncopa/lddtree https://github.com/ncopa/lddtree is a single-file bash re-implementation.
- totony 5y agoSeems like it uses ELF parsing, I wonder if it works on non-native binaries (lddtree does not)