[kwlug-disc] how to identify superfluous shared library references?

Khalid Baheyeldin kb at 2bits.com
Tue Mar 10 16:15:57 EDT 2009


>From the ldd man page, there is a -u for "Unused direct dependencies".

root at salmon:~# ldd /bin/ls
        linux-vdso.so.1 =>  (0x00007fff6c5fe000)
        librt.so.1 => /lib/librt.so.1 (0x00007f1263fde000)
        libselinux.so.1 => /lib/libselinux.so.1 (0x00007f1263dc2000)
        libacl.so.1 => /lib/libacl.so.1 (0x00007f1263bbb000)
        libc.so.6 => /lib/libc.so.6 (0x00007f1263859000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f126363d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f12641e7000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f1263439000)
        libattr.so.1 => /lib/libattr.so.1 (0x00007f1263235000)

root at salmon:~# ldd -u /bin/ls
Unused direct dependencies:
        /lib/librt.so.1
        /lib/libselinux.so.1
        /lib/libacl.so.1

Maybe that is what you need?

On Tue, Mar 10, 2009 at 3:45 PM, Robert P. J. Day <rpjday at crashcourse.ca>wrote:

>
>  i'm looking at an executable that was built with a couple dozen "-l"
> references to refer to shared libs to be linked at run time.  but only
> a few of those libs are actually used -- the list of libs was copied
> and pasted and is *way* overkill, but if you list them at compile
> time, they're going to show up via "ldd" in the final executable.
>
>  is there a way to identify which shared libs are actually being
> *used* by an executable, and which are superfluous and can be dropped
> from the list of libs during the compile step?
>
>  they don't hurt, of course, except for taking up a small amount of
> space in the executable, but if they're not necessary, i'd rather they
> not be there.  thanks.
>
> rday
> --
>
> ========================================================================
> Robert P. J. Day
> Linux Consulting, Training and Annoying Kernel Pedantry:
>    Have classroom, will lecture.
>
> http://crashcourse.ca                          Waterloo, Ontario, CANADA
> ========================================================================
>
> _______________________________________________
> kwlug-disc_kwlug.org mailing list
> kwlug-disc_kwlug.org at kwlug.org
> http://astoria.ccjclearline.com/mailman/listinfo/kwlug-disc_kwlug.org
>



-- 
Khalid M. Baheyeldin
2bits.com, Inc.
http://2bits.com
Drupal optimization, development, customization and consulting.
Simplicity is prerequisite for reliability. --  Edsger W.Dijkstra
Simplicity is the ultimate sophistication. --   Leonardo da Vinci
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20090310/df40868c/attachment.htm>


More information about the kwlug-disc mailing list