List shared libraries

Jump to: navigation, search

list static libraries

Other object/library exploration tools


Behold: The Dynamic Linker and Loader of Shared Libraries

The `ldd` command will list the shared libraries used by a given command. This is handy when trying to track down dependencies. If `ldd` is not available on your system then you can instead use, the dynamic linker and loader (not to be confused with `ld`, the GNU linker). In fact, the `ldd` command is just a shell script around the linker:

file `which ldd`
/usr/bin/ldd: Bourne-Again shell script text executable

You might have to hunt around for the command in /lib/. It should be a symlink, but it might not exist, which is OK. Just find its canonical name and other aliases:

ls -la /lib/ld*
-rwxr-xr-x 1 root root 117348 2009-08-31 11:46 /lib/
lrwxrwxrwx 1 root root      9 2009-09-14 20:45 /lib/ ->
lrwxrwxrwx 1 root root     13 2009-07-23 20:36 /lib/ ->
lrwxrwxrwx 1 root root     13 2009-07-23 20:36 /lib/ ->
lrwxrwxrwx 1 root root     13 2009-07-23 20:36 /lib/ ->

See `man` or `man`.

The following two examples are equivalent:

ldd /bin/bash
/lib/ --list /bin/bash

The `ldd` command has some options, such as -v which return info that can also be obtained with ``. The following two examples produce identical output:

ldd -v /bin/bash

Obviously `ldd` is a little easier to use.

Find missing library dependencies

The following Bash command will list the names of all missing library dependencies in your binary path, $PATH. Unfortunately, this doesn't make it easy to reverse the missing dependency back to the binary that requires it, but usually it is enough just to check that there are no missing libraries.

IFS=:;for BINDIR in $PATH; do ldd $BINDIR/*|grep "not found"|sort -u;done