From owner-freebsd-questions Sat Feb 8 18:20:29 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id SAA16617 for questions-outgoing; Sat, 8 Feb 1997 18:20:29 -0800 (PST) Received: (from jmb@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id SAA16607; Sat, 8 Feb 1997 18:20:22 -0800 (PST) From: "Jonathan M. Bresler" Message-Id: <199702090220.SAA16607@freefall.freebsd.org> Subject: Re: static vs. dynamically linked binaries To: allenh@wtrt.net (Allen Hyer) Date: Sat, 8 Feb 1997 18:20:21 -0800 (PST) Cc: freebsd-questions@freebsd.org In-Reply-To: <3.0.1.32.19970208194031.0075a288@wtrt.net> from "Allen Hyer" at Feb 8, 97 07:40:31 pm X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Allen Hyer wrote: > > > Is there any way to figure out if a binary was linked statically or > dynamically? I have some binaries around that I don't have the sources > installed for. Can I tell with just the binary, or do I need to go back to > the sources? yes, you can tell using the command "/usr/bin/file". freefall jmb[140] file /kernel /kernel: demand paged executable freefall jmb[141] file /usr/bin/vi /usr/bin/vi: FreeBSD/i386 demand paged dynamically linked executable "/usr/bin/ldd" will tell you which dynamic libs an executable uses. or complain if run against a static binary freefall jmb[145] ldd /kernel ldd: /kernel: not a dynamic executable /usr/bin/vi: -ltermcap.2 => /usr/lib/libtermcap.so.2.1 (0x805c000) -lcurses.2 => /usr/lib/libcurses.so.2.0 (0x8050000) -lutil.2 => /usr/lib/libutil.so.2.1 (0x804b000) -lc.2 => /usr/lib/libc.so.2.2 (0x806d000) jmb