Pages

Wednesday, September 12, 2012

Resource Management:LDD


ldd is a command available in linux that can be used to check the shared library dependencies of the executable of even a shared library

Basic Example,

[root@vx111a bin]# ldd java
        linux-gate.so.1 =>  (0x00f45000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00887000)
        libjli.so => /usr/jdk1.6.0_14/bin/../jre/lib/i386/jli/libjli.so (0x00fce000)
        libdl.so.2 => /lib/libdl.so.2 (0x00880000)
        libc.so.6 => /lib/libc.so.6 (0x006fa000)
        /lib/ld-linux.so.2 (0x006db000)

We can Use Ldd to find any Unused Direct Dependencies too like

[root@vx111a bin]# ldd -u java
Unused direct dependencies:

        /lib/libpthread.so.0
        /usr/jdk1.6.0_14/bin/../jre/lib/i386/jli/libjli.so
        /lib/libdl.so.2

Here are the Syntax and options for the command

ldd [OPTION]... FILE...

Option Option Description
-v         Print all information, including e.g. symbol versioning information.
-d         Perform relocations and report any missing objects (ELF only).
-r          Perform relocations for both data objects and functions, and report any missing objects or functions (ELF only).
-u         Print unused direct dependencies.
-help    Usage information.