Wireshark-dev: [Wireshark-dev] Has anybody successfully built a static version of Wireshark or
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 11 Oct 2010 00:04:19 -0700
On at least some platforms, you can't build 100% statically-linked programs:

	$ sw_vers
	ProductName:	Mac OS X
	ProductVersion:	10.6.4
	BuildVersion:	10F569
	$ cat iefbr14.c
	int
	main(void)
	{
		return 0;
	}
	$ gcc -static -o iefbr14 iefbr14.c
	ld: library not found for -lcrt0.o
	collect2: ld returned 1 exit status
	$ 

and, on others, you might be able to do so, but there's no guarantee that they'll work on any version of the OS other than the one on which you built it (if Solaris even allows it at all, it doesn't make any such guarantee).

I don't know whether you can build it statically on *any* UN*X and have plugin support - I tried it on Linux (Ubuntu 9, as I remember) and it didn't build with plugin support left enabled.  A 100% statically-linked binary, on most if not all UN*Xes, doesn't use the run-time linker and doesn't make it available, so you don't get to use the run-time-linking APIs.

Is there *any* platform on which you can build a 100% statically-linked Wireshark or TShark *and* have support for plugins?  If not, there's probably not much point in leaving in any support for it.

(I suspect most people who want a "statically-linked" Wireshark or TShark only care about libraries that aren't present on the platform on which they'll be deploying it, and are fine with dynamically linking to libc/libSystem/whatever your OS calls the bottommost system library.  Unfortunately, I don't think the auto*/libtool stuff understands the notion of a "mostly static binary" - it's all or nothing.)