Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 2002 08:28:54 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Darren Pilgrim <dmp@pantherdragon.org>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: How to tell if something is built static- or dynamic-linked?
Message-ID:  <20020801072854.GB41777@happy-idiot-talk.infracaninophi>
In-Reply-To: <3D4856F0.3773D429@pantherdragon.org>
References:  <3D4856F0.3773D429@pantherdragon.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jul 31, 2002 at 02:30:24PM -0700, Darren Pilgrim wrote:
> The OpenSSL bug has triggered me to learn how to figure out if a given
> program was built with static- or dynamic-linking?  I figure there's
> something in the Makefile, but what?

Virtually everything is built using dynamic linking --- the exceptions
being some absolutely crucial commands found in /sbin or /bin.  You
can use the file(1) command to see the difference:

    happy-idiot-talk:~:% file /bin/sh
    /bin/sh: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), statically linked, stripped
    happy-idiot-talk:~:% file /usr/bin/sed
    /usr/bin/sed: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked (uses shared libs), stripped

Use the ldd(1) command to see what shared libraries are linked to by a
dynamic executable:

    happy-idiot-talk:~:% ldd /usr/bin/sed
    /usr/bin/sed:
            libc.so.4 => /usr/lib/libc.so.4 (0x2806b000)

If you've installed a version of the openssl port, you can run:

     pkg_info -R openssl\*

to find the ports that depend on the openssl port, but that's not
guarranteed be either complete or accurate.

	Cheers,

	Matthew


-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
Tel: +44 1628 476614                                  Marlow
Fax: +44 0870 0522645                                 Bucks., SL7 1TH UK

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?20020801072854.GB41777>