Viewing dynamic executable dependencies

Large dynamically linked executables can have a LOT of dependencies, which are resolved by the runtime linker when a program is executed. To see which libraries an executable and the executable’s shared dependencies depend on, the ldd utility can be used:

$ ldd /usr/sbin/metastat =>  /lib/ =>     /lib/ =>   /lib/ =>   /lib/ =>         /lib/ =>   /lib/ =>   /lib/ =>       /lib/ =>   /lib/ =>    /lib/ =>   /lib/ =>  /lib/ =>        /lib/ =>  /lib/ =>         /lib/ =>        /lib/ =>     /lib/

To view just the shared libraries that the executable depends on, the elfdump “-d” (dump the contents of the dynamic symbol table) option can be used:

$ /usr/ccs/bin/elfdump -d /usr/sbin/metastat | grep NEEDED

       [0]  NEEDED           0x867   
       [1]  NEEDED           0x884   

In the examples above, metastat only requires two libraries, but those two libraries have numerous dependencies.

Leave a Reply

Your email address will not be published. Required fields are marked *