tcpdump mailing list archives

Re: Building tcpdump with static libraries


From: Guy Harris <guy () alum mit edu>
Date: Mon, 28 May 2012 01:14:42 -0700


On May 27, 2012, at 7:40 PM, Ajith Adapa wrote:

Now if I build tcpdump it is linked with shared libraries of libpcap and
others as shown below. Is it possible for me to create tcpdump binary
linking up with all static libraries ?

You would have to modify the Makefile by hand to statically link tcpdump; the way that would be done is 
platform-specific - as you're building on Linux, adding "-static" to the line that links tcpdump should suffice.  (You 
will, of course, have to make sure that static versions of all those libraries are installed on your system; I think 
that, on the major Linux distributions, the header files needed to compile programs using a library and the static 
version of that library are in a "{libraryname}-dev" package, or something such as that, so if you have the headers 
that allowed you to compile tcpdump in the first place, you probably also have the static versions of the libraries 
with which you need to link tcpdump.)

Also, if libpcap *itself* depends on libraries other than libc - try runnning "ldd /usr/lib/libpcap.so.0.8" to see what 
libraries it requires - and tcpdump isn't itself being linked with them by the Makefile - you will have to modify the 
link command in the Makefile to link with them.-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: