[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dependencies



*- On 20 Apr, ktb wrote about "dependencies"
> A few weeks ago someone posted a command that showed the dependencies of
> a program.  I must have inadvertently deleted it and can't find it in
> the archives.  Anyway I would like to know how to reveal what libs a
> program uses or needs and once I find the libs know how to find the
> package the libs reside in. How do I do this? 
> Thanks,
> kent
> 
> 

Here is a hack I just threw together.  It requires that you have a
local copy of the Contents file for your arch in /var/lib/dpkg.  

#!/bin/sh
# findlibpkg:  Find the libs that a executable depends on and what 
#              package they are in.
#
# usage:   findlibpkg <full path of executable>

LIST=`ldd $1 | cut -d" " -f3`
for i in $LIST ; do
    zgrep "`echo $i | sed -e 's/^\///'` " /var/lib/dpkg/Contents.gz
done

#end findlibpkg



As an example:

% findlibpkg /usr/bin/gs
usr/lib/libz.so.1                                            libs/zlib1g
usr/X11R6/lib/libXt.so.6                                     x11/xlib6g
usr/X11R6/lib/libXext.so.6                                   x11/xlib6g
usr/X11R6/lib/libX11.so.6                                    x11/xlib6g
usr/lib/libvga.so.1                                          libs/svgalib-dummyg1,libs/svgalibg1,libs/svgalib1-libggi1
usr/lib/libvgagl.so.1                                        libs/svgalib-dummyg1,libs/svgalibg1,libs/svgalib1-libggi1
lib/libpthread.so.0                                          base/libc6
usr/lib/libpthread.so.0                                      oldlibs/libpthread0
usr/lib/libpng.so.2                                          libs/libpng2
usr/lib/libpaper.so.1                                        libs/libpaperg
lib/libm.so.6                                                base/libc6
lib/libc.so.6                                                base/libc6
usr/X11R6/lib/libSM.so.6                                     x11/xlib6g
usr/X11R6/lib/libICE.so.6                                    x11/xlib6g
lib/ld-linux.so.2                                            base/libc6

I suppose this could be expanded to use the search engine at 
http://www.debian.org/distrib/packages.html via a direct call to the
cgi script and lynx or something.  That is for another day though.

Enjoy,
-- 
Brian 
---------------------------------------------------------------------
"Never criticize anybody until you have walked a mile in their shoes,  
 because by that time you will be a mile away and have their shoes." 
							   - unknown  

Mechanical Engineering                                bservis@usa.net
Purdue University                   http://www.ecn.purdue.edu/~servis
---------------------------------------------------------------------


Reply to: