Instructions for Cygwin's GCC
This page is obsolete.
The following experimental information is about compiling Wireshark using cygwin's GCC compiler on Windows.
Please remember that MSVC6 is the recommended compiler to build Wireshark on Win32 platforms, see the Developer's Guide for details.
Using GCC might be quite difficult and the built binaries will only run in a cygwin environment using an X server, so they are not standalone Win32 applications.
It is however not excluded that native Win32 code can be compiled on cygwin GCC but you then have to use -mms-bitfields as a strict minimum and probably -mno-cygwin or a similar compiler flag too.
It is possible to build Wireshark under Cygwin using their version of XFree86. References:
- http://www.ethereal.com/lists/ethereal-dev/200205/msg00107.html - http://www.ethereal.com/lists/ethereal-dev/200302/msg00026.html
To get it running, execute the following steps:
1. Install the required cygwin packages (compiler, scripting, X, zlib)
with the CygWin setup.exe tool (http://www.cygwin.com/). You need the base Xfree86 support plus the X headers package in order to be able to compile the gtk+ package.
2. Download glib-1.2.10 and gtk+-1.2.10 from a mirror of www.gnome.org.
3. Retrieve the patches for glib-1.2.10 and gtk+-1.2.10 from
- + glib-1.2.10
http://homepage.ntlworld.com/steven.obrien2/ (URL cont'd on next line)
- /libs/patches/glib-1.2.10-cygwin.patch
http://homepage.ntlworld.com/steven.obrien2/ (URL cont'd on next line)
- /libs/patches/gtk+-1.2.10-cygwin.patch
4. Compile and install both packages after patching (see instructions
at the bottom of http://homepage.ntlworld.com/steven.obrien2/): Set the path:
- $ PATH=/opt/gnome/bin:/usr/X11R6/bin:$PATH
- $ cd glib-1.2.10
$ patch -p1 < /path/to/glib-1.2.10-cygwin.patch $ CFLAGS=-O2 ./configure --prefix=/opt/gnome --with-threads=posix $ make $ make check $ make install
- $ cd gtk+-1.2.10
$ patch -p1 < /path/to/gtk+-1.2.10-cygwin.patch $ CFLAGS=-O2 ./configure --prefix=/opt/gnome $ make $ make check $ make install
5. Patch Makefile.am in <wireshark-src>/gtk/Makefile.am by
- removing "ethclist.c" from the dependencies. This patch is required since the private GTK+ clist widget (was required for earlier versions of GTK+ but prevents Wireshark from running with cygwin).
6. Configure and make Wireshark:
- Set the path (if this has not yet been done earlier)
- $ PATH=/opt/gnome/bin:$PATH $ ./autogen.sh $ ./configure --config-cache --without-pcap $ make
7. Start X
- $ sh /usr/X11R6/bin/startxwin.sh
Or you can start it from C:\cygwin\usr\X11R6\bin\startxwin.bat
8. Run wireshark (add /opt/gnome/bin to $PATH if this is not yet done)
$ <wireshark-src>/wireshark
- And voila! Behold the mighty sniffer in all its glory! Note that the plugin dissectors must be installed (make install) if you want to use them. Note also that running "make install" produces lots of output to the console; this is normal.
Note: Compiling Wireshark under cygwin takes a lot of time, because the generation of 'register.c' takes ages. If you only edit one dissector and you know what you're doing, it is acceptable to uncomment the generation of the file 'register.c' in Makefile. Look for the 'register.c' target:
- register.c: $(DISSECTOR_SRC) $(srcdir)/make-reg-dotc
- @echo Making register.c # @$(srcdir)/make-reg-dotc register.c $(srcdir) $(DISSECTOR_SRC) @echo Skipping generation of register.c
Of course, you need to generate the 'register.c' file at least once.
Note: You can also capture packets on a cygwin built Wireshark. You then have to unpack the WinPCap development package, install the files in lib/ and include/ in say /usr/lib and /usr/include (they must be in the search path of the compiler and linker, otherwise you have to specify the configure option --with-pcap=/location/to/pcap so the packet capture functionality can be used. In order to run Wireshark, you have to add the .dll files in a directory in the PATH (e.g., /bin). Should you want packet capturing enabled in the cygwin build, then you have to remove --without-pcap from step 6.
