Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-users: Re: [Wireshark-users] compile static built tshark

From: Tim Wieneke <tim@xxxxxxx>
Date: Tue, 17 Nov 2009 09:17:15 +0100
Hi,

I tried this before as well on soalris x64 but also not working:


Hi,

I tried (unsuccessfully) to compile static binaries out of wireshark 1.2.1. Idee was to get a static binary of tshark to have a simply sniffer tool.

What I did:

./configure --prefix=/opt/wireshark --disable-glibtest --disable-plugins --enable-static --disable-shared --enable-tshark --disable-wireshark --disable-gtktest --disable-glibtest --disable-editcap --disable-capinfos --disable-mergecap --disable-text2pcap --disable-idl2wrs --disable-dftest --disable-randpkt --enable-dumpcap --disable-rawshark --disable-ipv6


What I got:

make[2]: Entering directory `/export/home/wireshark-1.2.1'
LANG=C /opt/csw/bin/perl ./make-version.pl .
Version configuration file version.conf not found.  Using defaults.
This is not a SVN build.
svnversion.h is up-to-date.
/bin/bash ./libtool --tag=CC --mode=link gcc -D_U_="__attribute__((unused))" -g -O2 -Wall -W -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wcast-align -Wformat-security -Wno-return-type -DFUNCPROTO=15 -I/usr/local/include -I/opt/csw/include/glib-2.0 -I/opt/csw/lib/glib-2.0/include -Wl,-static -all-static -L/opt/csw/lib -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib -R/usr/local/lib -o tshark tshark-capture-pcap-util-unix.o tshark-capture_errs.o tshark-capture-pcap-util.o tshark-capture_ui_utils.o tshark-cfile.o tshark-clopts_common.o tshark-disabled_protos.o tshark-packet-range.o tshark-print.o tshark-ps.o tshark-sync_pipe_write.o tshark-timestats.o tshark-util.o tshark-tap-megaco-common.o tshark-tap-rtp-common.o tshark-version_info.o tshark-tap-afpstat.o tshark-tap-ansi_astat.o tshark-tap-bootpstat.o tshark-tap-camelcounter.o tshark-tap-camelsrt.o tshark-tap-comparestat.o tshark-tap-dcerpcstat.o tshark-tap-funnel.o tshark-tap-gsm_astat.o tshark-tap-h225counter.o tshark-tap-h225rassrt.o tshark-tap-httpstat.o tshark-tap-iostat.o tshark-tap-iousers.o tshark-tap-mgcpstat.o tshark-tap-megacostat.o tshark-tap-protocolinfo.o tshark-tap-protohierstat.o tshark-tap-radiusstat.o tshark-tap-rpcstat.o tshark-tap-rpcprogs.o tshark-tap-rtp.o tshark-tap-sctpchunkstat.o tshark-tap-sipstat.o tshark-tap-smbsids.o tshark-tap-smbstat.o tshark-tap-stats_tree.o tshark-tap-wspstat.o tshark-capture_opts.o tshark-capture_sync.o tshark-tempfile.o tshark-tshark-tap-register.o tshark-tshark.o wiretap/libwiretap.la epan/libwireshark.la wsutil/libwsutil.la -dlopen plugins/asn1/asn1.la -dlopen plugins/docsis/docsis.la -dlopen plugins/ethercat/ethercat.la -dlopen plugins/giop/cosnaming.la -dlopen plugins/giop/coseventcomm.la -dlopen plugins/gryphon/gryphon.la -dlopen plugins/irda/irda.la -dlopen plugins/m2m/m2m.la -dlopen plugins/mate/mate.la -dlopen plugins/opcua/opcua.la -dlopen plugins/profinet/profinet.la -dlopen plugins/sercosiii/sercosiii.la -dlopen plugins/stats_tree/stats_tree.la -dlopen plugins/unistim/unistim.la -dlopen plugins/wimax/wimax.la -L/opt/csw/lib -lgmodule-2.0 -lglib-2.0 -lintl -lm -lpcap -lsocket -lnsl -L/opt/csw/lib -lgcrypt -lgpg-error -L/opt/csw/lib -lgnutls -lnsl -lz -R/opt/csw/gcc3/lib
rm -f .libs/tshark.nm .libs/tshark.nmS .libs/tshark.nmT
creating .libs/tsharkS.c
extracting global C symbols from `plugins/asn1/.libs/asn1.a'
extracting global C symbols from `plugins/docsis/.libs/docsis.a'
extracting global C symbols from `plugins/ethercat/.libs/ethercat.a'
extracting global C symbols from `plugins/giop/.libs/cosnaming.a'
extracting global C symbols from `plugins/giop/.libs/coseventcomm.a'
extracting global C symbols from `plugins/gryphon/.libs/gryphon.a'
extracting global C symbols from `plugins/irda/.libs/irda.a'
extracting global C symbols from `plugins/m2m/.libs/m2m.a'
extracting global C symbols from `plugins/mate/.libs/mate.a'
extracting global C symbols from `plugins/opcua/.libs/opcua.a'
extracting global C symbols from `plugins/profinet/.libs/profinet.a'
extracting global C symbols from `plugins/sercosiii/.libs/sercosiii.a'
extracting global C symbols from `plugins/stats_tree/.libs/stats_tree.a'
extracting global C symbols from `plugins/unistim/.libs/unistim.a'
extracting global C symbols from `plugins/wimax/.libs/wimax.a'
(cd .libs && gcc  -g -O2 -c -fno-builtin "tsharkS.c")
rm -f .libs/tsharkS.c .libs/tshark.nm .libs/tshark.nmS .libs/tshark.nmT
gcc "-D_U_=__attribute__((unused))" -g -O2 -Wall -W -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wcast-align -Wformat-security -Wno-return-type -DFUNCPROTO=15 -I/usr/local/include -I/opt/csw/include/glib-2.0 -I/opt/csw/lib/glib-2.0/include -Wl,-static -o tshark tshark-capture-pcap-util-unix.o tshark-capture_errs.o tshark-capture-pcap-util.o tshark-capture_ui_utils.o tshark-cfile.o tshark-clopts_common.o tshark-disabled_protos.o tshark-packet-range.o tshark-print.o tshark-ps.o tshark-sync_pipe_write.o tshark-timestats.o tshark-util.o tshark-tap-megaco-common.o tshark-tap-rtp-common.o tshark-version_info.o tshark-tap-afpstat.o tshark-tap-ansi_astat.o tshark-tap-bootpstat.o tshark-tap-camelcounter.o tshark-tap-camelsrt.o tshark-tap-comparestat.o tshark-tap-dcerpcstat.o tshark-tap-funnel.o tshark-tap-gsm_astat.o tshark-tap-h225counter.o tshark-tap-h225rassrt.o tshark-tap-httpstat.o tshark-tap-iostat.o tshark-tap-iousers.o tshark-tap-mgcpstat.o tshark-tap-megacostat.o tshark-tap-protocolinfo.o tshark-tap-protohierstat.o tshark-tap-radiusstat.o tshark-tap-rpcstat.o tshark-tap-rpcprogs.o tshark-tap-rtp.o tshark-tap-sctpchunkstat.o tshark-tap-sipstat.o tshark-tap-smbsids.o tshark-tap-smbstat.o tshark-tap-stats_tree.o tshark-tap-wspstat.o tshark-capture_opts.o tshark-capture_sync.o tshark-tempfile.o tshark-tshark-tap-register.o tshark-tshark.o .libs/tsharkS.o -L/opt/csw/lib -L/usr/local/lib plugins/asn1/.libs/asn1.a plugins/docsis/.libs/docsis.a plugins/ethercat/.libs/ethercat.a plugins/giop/.libs/cosnaming.a plugins/giop/.libs/coseventcomm.a plugins/gryphon/.libs/gryphon.a plugins/irda/.libs/irda.a plugins/m2m/.libs/m2m.a plugins/mate/.libs/mate.a plugins/opcua/.libs/opcua.a plugins/profinet/.libs/profinet.a plugins/sercosiii/.libs/sercosiii.a plugins/stats_tree/.libs/stats_tree.a plugins/unistim/.libs/unistim.a plugins/wimax/.libs/wimax.a wiretap/.libs/libwiretap.a -L/opt/csw/mozilla/firefox/lib -L/opt/csw/lib/evolution/2.6 -L/usr/openwin/lib epan/.libs/libwireshark.a /export/home/wireshark-1.2.1/wsutil/.libs/libwsutil.a wsutil/.libs/libwsutil.a /opt/csw/lib/libgmodule-2.0.so -ldl /opt/csw/lib/libglib-2.0.so -lsunmath -lm -lpcap /opt/csw/lib/libgnutls.so /opt/csw/lib/libgcrypt.so /opt/csw/lib/libgpg-error.so /opt/csw/lib/libintl.a /opt/csw/lib/libiconv.so -lc -lsocket -lnsl -lz -R/opt/csw/lib -R/opt/csw/lib -R/usr/local/lib -R/opt/csw/gcc3/lib
ld: fatal: option -dy and -a are incompatible
ld: fatal: Flags processing errors
collect2: ld returned 1 exit status
rm -f .libs/tsharkS.o
make[2]: *** [tshark] Error 1
make[2]: Leaving directory `/export/home/wireshark-1.2.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/export/home/wireshark-1.2.1'
make: *** [all] Error 2


Remedy:
I did the build again (this time removed the line "--enable-static --disable-shared") and got finally a nice sun package. Nevertheless I would like to have a simply tshark binary with only a few dependencies.

Any hints to get around the nasty/blocking error with the dynamic linker stating the "-dy/-a" issue?

cheers
tim
Quoting Greg <j.greg.k@xxxxxxxxx>:

I attempted to compile tshark on centos 4.7 today as a static binary.
Configure went fine, make went fine and so I copied the tshark binary
to a test system and tried running it. It would exit. I traced the
exit to tshark trying to launch a dumpcap child process. So I ran
dumpcap and dumpcap is not being statically built during the process.
It tries reading from a libpcap share object file.

Here is what my configure looks like:

./configure --enable-static=yes --enable-wireshark=no
--disable-gtktest --enable-shared=no --with-zlib=no --with-pcre=no
--with-krb5=no --with-adns=no --withgeoip=no --with-plugins=no
--enable-editcap=no --enable-capinfos=no --enable-mergecap=no
--enable-text2pcap=no --enable-idl2wrs=no --enable-dftest=no
--enable-randpkt=no --enable-rawshark=no --with-gcrypt=no
--with-libsmi=no --without-portaudio --without-lua


Any ideas on what I am missing?


-Greg
___________________________________________________________________________
Sent via:    Wireshark-users mailing list <wireshark-users@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-users
Unsubscribe: https://wireshark.org/mailman/options/wireshark-users
             mailto:wireshark-users-request@xxxxxxxxxxxxx?subject=unsubscribe




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.