Ethereal-dev: [Ethereal-dev] [CYGWIN]Build hints

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

From: Loïc Minier <lool+ethereal@xxxxxxxxxx>
Date: Thu, 13 Nov 2003 14:55:12 +0100
     'Morning list,

 I am trying again to build Ethereal under Cygwin. I am interested in
 tethereal only, but I tried to build the whole thing, and - guess what
 - I succeeded!

 It was 10 times easier than last time I tried, because I read the
 interesting posts of Olivier Biot and Shiang-Ming.

 I'd like to summarize the small patches/glitches I experienced so that:
 - you might hint me on their causes ;
 - they can be fixed ;
 - other users can read them.

   Could you commit the above "guidelines/hints"? Thanks.

============

     What options do you have when building Ethereal under Windows?

   Build tools (C compiler, make, ...)

 - Visual Studio 6 or above ;
 - MinGW <http://www.mingw.org/> ;
 - Cygwin's gcc.
 (Here I assume Cygwin's gcc.)

   Libraries

 - GTK 1 under XFree (you'll need Cygwin's XFree server) ;
 - GTK 2 under XFree (you'll need Cygwin's XFree server) ;
 - GTK 1 under Windows ;
 - GTK 2 under Windows.

 Here I choose GTK 2 under Windows, but simply choosing the gtk2-x11
 package under Cygwin should be enough to build for the GTK 2 XFree
 version. If you're interested in building for GTK 1, please refer to
 earlier guides, for example:
   - Olivier Biot's post in Ethereal-Dev at:
     <http://www.ethereal.com/lists/ethereal-dev/200302/msg00021.html>
   - Shiang-Ming's HOWTO at:
     <http://www.csie.nctu.edu.tw/~smhuang/02build_ethereal.html>

 First part, getting the necessary stuff:
 - get Cygwin's setup.exe, install the distribution with a working
 mirror PLUS an additionnal URL (you can select multiple URLs in "Choose
 A Download Site"): <http://web.sfc.keio.ac.jp>
 - add the following packages to the default set:
   . in section Devel:        autoconf, automake, byacc, flex, gcc,
                              libiconv, libtool, make, pkgconfig
   . in section GNOME2:       glib, atk, pango, fontconfig
   . in section Interpreters: python
   . in section Libs:         fontconfig, freetype2, libfontconfig1,
                              libiconv, libiconv2, libintl, libintl1,
                              libintl2, zlib, glib, atk, gtk2-win32, pango
 (I guess most of the libs are already selected when you've selected the
 package, but I don't know which proved being necessary afterwards.)
 - get Ethereal's source code, for example from:
   . a nightly-tarball at:
         <http://www.ethereal.com/distribution/nightly-builds/>
   . a source distribution of a particular version:
         <http://www.ethereal.com/distribution/all-versions/>
   . CVS:
     * cvs -d:pserver:anoncvs@xxxxxxxxxxxxxxxx:/cvsroot login
     * (empty password, press enter)
     * cvs -d:pserver:anoncvs@xxxxxxxxxxxxxxxx:/cvsroot co ethereal
 - unpack Ethereal's source code if necessary
 - get Winpcap's developper pack, mine is called wpdpack_3_0.zip, and
   it's available at:
       <http://winpcap.polito.it/install/default.htm>
 - copy the *.a files in the "Lib" directory of the zip to
   /usr/local/lib and the structure below the "Include" directory in
   /usr/local/include
 - cd to /usr/local/lib and make a symbolic link named libpcap.a on
 libwpcap.a, with the command "ln -s libwpcap.a libpcap.a"

 Second part, building:
 - run ./autogen.sh from the top source directory, this is the script
 supposed to detect and run your autoconf and automake tools to generate
 the "configure" scripts
 - run ./configure from the top source directory, this is where you
 usually give some build options like the thing you'd like to build and
 where to find libraries if they are not automatically detected. Since I
 did not install any GTK 1 libraries, but GTK 2 instead, I had to give
 the "--enable-gtk2" option. Also, I did not manage t oget the plugins
 built, so I used "--without-plugins". Altogether:
     "./configure --enable-gtk2 --without-plugins"
 I experienced problems because my home directory had a space in
 its path resulting in some "cd $ac_popdir" failing, I changed all cd
 commands to "cd "$path"", and then configure ran without problem.
 - run "make ethereal.exe" or "make tethereal.exe" depending on what
 you'd like to use.

 If you're lucky and I'm not, then you have a working .exe. Look at
 the _first_ *error* you get (ignore warnings caused by unappropriate
 compiler flags for example). If it looks like a header is missing (a
 reference in the source to a function which is not described in the
 included header), this might be because of the configure options that
 have been misdetected or not passed correctly to the C-preprocessor.
   The only changes I had to do for tethereal were:
 - replace VERSION, PACKAGE, and PLUGIN_DIR by the variables found in
 Makefile (Something like "Ethereal", "0.9.16", and "plugins"
 - remove some conditionnal includes (ifdefs), here's a diff -u patch
 that could can read and copy or apply to tethereal.c:
--- tethereal.c 2003-11-01 03:30:15.000000000 +0100
+++ ../ethereal-0.9.16/tethereal.c      2003-11-13 11:18:46.670888000 +0100
@@ -35,9 +35,7 @@
 #include <locale.h>
 #include <limits.h>
 
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
 #include <errno.h>
 
@@ -64,9 +62,7 @@
 #include "strerror.h"
 #endif
 
-#ifdef NEED_GETOPT_H
 #include "getopt.h"
-#endif
 
 #include <glib.h>
 #include <epan/epan.h>
@@ -99,9 +95,7 @@
 #include <wiretap/libpcap.h>
 #endif
 
-#ifdef _WIN32
 #include "capture-wpcap.h"
-#endif
 
 /*
  * This is the template for the decode as option; it is shared between the
<<EOF

-- 
Lo�c Minier <lool@xxxxxxxx>