Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Jul 1999 11:11:02 +0930
From:      Greg Lehey <grog@lemis.com>
To:        Matt Behrens <matt@zigg.com>, Alfred Perlstein <bright@rush.net>, Jonathon Doran <doranj@Colorado.EDU>
Cc:        questions@FreeBSD.ORG
Subject:   Re: Which shared libraries is a binary linked against?
Message-ID:  <19990704111102.H709@freebie.lemis.com>
In-Reply-To: <Pine.BSF.4.10.9907031151590.19135-100000@megaweapon.zigg.com>; from Matt Behrens on Sat, Jul 03, 1999 at 11:52:45AM -0400
References:  <Pine.BSF.4.10.9907031151590.19135-100000@megaweapon.zigg.com> <199907031706.LAA16822@ucsu.Colorado.EDU> <Pine.BSF.4.10.9907031151590.19135-100000@megaweapon.zigg.com> <Pine.BSF.3.96.990703112726.14320t-100000@cygnus.rush.net> <Pine.BSF.4.10.9907031151590.19135-100000@megaweapon.zigg.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday,  3 July 1999 at 11:52:45 -0400, Matt Behrens wrote:
> I've been RTFMing for awhile now and can't seem to find a way to
> determine which shared libraries any arbitrary binary depends on.
> Is there a way?

Use ldd(1):

  $ldd /usr/local/bin/emacs
  /usr/local/bin/emacs:
        -lXaw.6 => /usr/X11R6/lib/aout/libXaw.so.6.1 (0x2011d000)
        -lXmu.6 => /usr/X11R6/lib/aout/libXmu.so.6.0 (0x20150000)
        -lXt.6 => /usr/X11R6/lib/aout/libXt.so.6.0 (0x2015f000)
        -lX11.6 => /usr/X11R6/lib/aout/libX11.so.6.1 (0x2019b000)
        -lSM.6 => /usr/X11R6/lib/aout/libSM.so.6.0 (0x2022b000)
        -lICE.6 => /usr/X11R6/lib/aout/libICE.so.6.3 (0x20233000)
        -lXext.6 => /usr/X11R6/lib/aout/libXext.so.6.3 (0x20244000)
        -lutil.2 => /usr/lib/aout/libutil.so.2.2 (0x2024d000)
        -ltermcap.2 => /usr/lib/aout/libtermcap.so.2.2 (0x20254000)
        -lgcc.261 => /usr/lib/aout/libgcc.so.261.0 (0x20258000)
        -lm.2 => /usr/lib/aout/libm.so.2.0 (0x2025c000)
        -lc.3 => /usr/lib/aout/libc.so.3.1 (0x20276000)

On Saturday,  3 July 1999 at 11:27:45 -0500, Alfred Perlstein wrote:
> On Sat, 3 Jul 1999, Matt Behrens wrote:
>
>> I've been RTFMing for awhile now and can't seem to find a way to
>> determine which shared libraries any arbitrary binary depends on.
>> Is there a way?
>
> try "nm"

No, this will just tell you which symbols are in the binary.

On Saturday,  3 July 1999 at 11:06:40 -0600, Jonathon Doran wrote:
>> I've been RTFMing for awhile now and can't seem to find a way to
>> determine which shared libraries any arbitrary binary depends on.
>> Is there a way?
>
> How about this:
>
> 	strings "binary" | fgrep ".so."
>
> Where "binary" is the name of your arbitrary binary.

This will give it to you, along with a lot of noise.  For example,

  $ strings /usr/local/bin/emacs | fgrep .so. 

will give you each library twice, and uncounted instances of
libjspBsdx86.so.2.7.

It's nice to see people making suggestions, but for your own sakes,
why don't you try them first?

Greg
--
When replying to this message, please copy the original recipients.
For more information, see http://www.lemis.com/questions.html
See complete headers for address, home page and phone numbers
finger grog@lemis.com for PGP public key


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990704111102.H709>