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

Ethereal-dev: [Ethereal-dev] Build native Win32 Ethereal with cygwin!

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Biot Olivier <Olivier.Biot@xxxxxxxxxxx>
Date: Thu, 11 Mar 2004 15:56:03 +0100
Hi list,

Thanks to Stephen Blackheath's hints I eventually succeeded in building an
Ethereal version that is linked against "native Win32" libraries. If you
drop the so-built ethereal.exe in an existing Ethereal installation
directory (e.g., "C:\Program Files\Ethereal"), then it runs smoothly (and
*much* faster than a cygwin binary). For some symbols you still need
cygwin1.dll so drop that library too in the same directory as ethereal.exe).

The only trick is to compile the whole Ethereal code with "-mms-bitfields"
and then to  *manually* fix the final libtool that builds Ethereal by
replacing all occurrences of cygwin libraries (in /usr/local/lib... or
/usr/lib/... or even -l<lib>) with the native Win32 libraries (which I put
in /target/lib/).

The configure I used:

CC='gcc -mms-bitfields' ./configure --without-plugins --without-pcre
--without-zlib --without-pcap --enable-gtk2 --disable-tethereal
--disable-editcap --disable-mergecap --disable-text2pcap --disable-idl2eth
--disable-randpkt --disable-dftest --disable-usr-local

For me the last step looks like (I replaced the pcap-utls-unix.o with
capture-wpcap.o after a "make capture-wpcap.o"):

/bin/sh  ./libtool --mode=link gcc -mms-bitfields
"-D_U_=__attribute__((unused))" -Wall -W -g -O2 -D_REENTRANT
-I/target/include/gtk-2.0 -I/target/lib/gtk-2.0/include
-I/target/include/atk-1.0 -I/target/include/pango-1.0
-I/target/include/glib-2.0 -I/target/lib/glib-2.0/include -o ethereal.exe
capture-wpcap.o capture_stop_conditions.o cfile.o conditions.o
disabled_protos.o pcap-util.o print.o ps.o range.o ringbuffer.o timestats.o
version_info.o alert_box.o capture.o file.o filters.o proto_hier_stats.o
summary.o -Wl,--export-dynamic  wiretap/libwiretap.a gtk/libui.a
epan/libethereal.a epan/ftypes/libftypes.a epan/dfilter/libdfilter.a
-L/target/lib /target/lib/libgtk-win32-2.0.dll.a
/target/lib/libgdk-win32-2.0.dll.a /target/lib/libatk-1.0.dll.a
-L/target/lib /target/lib/libgdk_pixbuf-2.0.dll.a
/target/lib/libpangowin32-1.0.dll.a -lgdi32 /target/lib/libpango-1.0.dll.a
/target/lib/libgobject-2.0.dll.a /target/lib/libgmodule-2.0.dll.a
/target/lib/libgthread-2.0.dll.a /target/lib/libglib-2.0.dll.a -luser32
-lkernel32 /target/lib/libintl.dll.a /target/lib/libiconv.dll.a 
gcc -mms-bitfields "-D_U_=__attribute__((unused))" -Wall -W -g -O2
-D_REENTRANT -I/target/include/gtk-2.0 -I/target/lib/gtk-2.0/include
-I/target/include/atk-1.0 -I/target/include/pango-1.0
-I/target/include/glib-2.0 -I/target/lib/glib-2.0/include -o ethereal.exe
capture-wpcap.o capture_stop_conditions.o cfile.o conditions.o
disabled_protos.o pcap-util.o print.o ps.o range.o ringbuffer.o timestats.o
version_info.o alert_box.o capture.o file.o filters.o proto_hier_stats.o
summary.o -Wl,--export-dynamic  wiretap/libwiretap.a gtk/libui.a
epan/libethereal.a epan/ftypes/libftypes.a epan/dfilter/libdfilter.a
-L/target/lib /target/lib/libgtk-win32-2.0.dll.a
/target/lib/libgdk-win32-2.0.dll.a /target/lib/libatk-1.0.dll.a
/target/lib/libgdk_pixbuf-2.0.dll.a /target/lib/libpangowin32-1.0.dll.a
-lgdi32 /target/lib/libpango-1.0.dll.a /target/lib/libgobject-2.0.dll.a
/target/lib/libgmodule-2.0.dll.a /target/lib/libgthread-2.0.dll.a
/target/lib/libglib-2.0.dll.a -luser32 -lkernel32 /target/lib/libintl.dll.a
/target/lib/libiconv.dll.a
Info: resolving _optarg by linking to __imp__optarg (auto-import)
Info: resolving _optind by linking to __imp__optind (auto-import)

Et voilà :)

Regards,

Olivier