Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dependency resolution in Linux

Under Windows I have used a program called dependency walker to examine the libraries the application is using. I was wondering how I can achieve this on Linux for a standard binary:

ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.0, stripped

Thanks.

like image 651
James Avatar asked Jul 13 '09 17:07

James


1 Answers

Try:

ldd executable

For example:

[me@somebox ~]$ ldd /bin/ls
        linux-gate.so.1 =>  (0xb7f57000)
        librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb7f4c000)
        libselinux.so.1 => /lib/libselinux.so.1 (0xb7f32000)
        libacl.so.1 => /lib/libacl.so.1 (0xb7f2b000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7ddc000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb7dc4000)
        /lib/ld-linux.so.2 (0xb7f58000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7dc0000)
        libattr.so.1 => /lib/libattr.so.1 (0xb7dbb000)
[me@somebox ~]$ 

Note that this will only report shared libraries. If you need to find out what static libraries were linked in at compile time, that's a bit trickier, especially seeing as your executable is 'stripped' (no debugging symbols).

like image 127
Mark Johnson Avatar answered Sep 20 '22 16:09

Mark Johnson