This wiki has been migrated to https://gitlab.com/wireshark/wireshark/-/wikis/home and is now deprecated. Please use that site instead.
Differences between revisions 18 and 19
Revision 18 as of 2006-06-05 03:19:14
Size: 7558
Editor: localhost
Comment:
Revision 19 as of 2006-09-19 14:24:15
Size: 8886
Editor: AndrewFeren
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 9: Line 8:
Line 17: Line 15:
Line 21: Line 18:
Line 26: Line 22:
   * Archive>Unzip
    * Base>bash
   * Base>coreutils
    * Base>findutils
    * Base>grep
    * Base>sed
    * Base>which
    * Devel>bison
    * Devel>flex
    * Interpreters>Perl
   * Interpreters>Python
    * Web>wget
  * Archive>Unzip
  * Base>bash
  * Base>coreutils
  * Base>findutils
  * Base>grep
  * Base>sed
  * Base>which
  * Devel>bison
  * Devel>flex
  * Interpreters>Perl
  * Interpreters>Python
  * Web>wget
Line 40: Line 35:
Line 42: Line 36:
Line 49: Line 42:
At this point you can run [[Anchor(setup)]]{{{nmake -f Makefile.nmake setup}}} from within the wireshark src dir. Once it downloads all the required libs, you should download zlib and compile it
by running {{{nmake -f win32/Makefile.msc}}}. If you are using the free SDK toolkits, you will have to change the {{{AR=lib}}} line to {{{AR=link /lib}}}. Note that building zlib this way from source is required, even though binaries is provided. This seems to be due to some incompatibility with {{{MSVCR71.DLL}}}.
At this point you can run [[Anchor(setup)]]{{{nmake -f Makefile.nmake setup}}} from within the wireshark src dir. Once it downloads all the required libs, you should download zlib and compile it by running {{{nmake -f win32/Makefile.msc}}}. If you are using the free SDK toolkits, you will have to change the {{{AR=lib}}} line to {{{AR=link /lib}}}. Note that building zlib this way from source is required, even though binaries is provided. This seems to be due to some incompatibility with {{{MSVCR71.DLL}}}.
Line 52: Line 44:
Once the build is complete, run  Once the build is complete, run
Line 57: Line 50:
If you are building under the SDK's, you will need to compile setargv.obj:
Line 58: Line 52:
If you are building under the SDK's, you will need to compile setargv.obj:
Line 64: Line 57:
Line 66: Line 58:
Line 74: Line 65:
Line 78: Line 68:
Line 83: Line 74:
'''plugins/mate/mate_plugin.c''':
Line 84: Line 76:
'''plugins/mate/mate_plugin.c''':
Line 88: Line 79:
'''plugins/mgcp/packet-mgcp.c''':
Line 89: Line 81:
'''plugins/mgcp/packet-mgcp.c''':
Line 94: Line 85:
You may also encounter linking problems caused by "bad" parameters in config.nmake. For example:
Line 95: Line 87:
 . {{{... unresolved external symbol __imp__errno ...}}} {{{... unresolved external symbol __imp__fseek ...}}} {{{... unresolved external symbol __imp__strtoul ...}}}
I replaced:
Line 96: Line 90:
You may also encounter linking problems caused by "bad" parameters in config.nmake. For example:
 {{{... unresolved external symbol __imp__errno ...}}}

 {{{... unresolved external symbol __imp__fseek ...}}}

 {{{... unresolved external symbol __imp__strtoul ...}}}

I replaced:
Line 106: Line 92:
While compiling plugins, you might also encounter problems. For these plugins, in the Makefile.nmake file change
Line 107: Line 94:
While compiling plugins, you might also encounter problems. For these
plugins, in the Makefile.nmake file change
Line 111: Line 96:
Line 112: Line 98:
Line 116: Line 101:
Line 122: Line 106:
Line 127: Line 110:
---------------------------------

This wiki entry was based upon [http://thread.gmane.org/gmane.network.wireshark.devel/12491 this mailinglist thread].
----------
 . This wiki entry was based upon [http://thread.gmane.org/gmane.network.wireshark.devel/12491 this mailinglist thread].
Line 136: Line 117:
The cygwin tools are described in the developers guide, so it might be a better way to link to the developer's guide (and probably update it) and link from here instead of duplicating information in the wiki.
The developer's guide was an attempt to provide detailed information about setting up a build environment. I don't know if another step-by-step guide is a good idea. - ''UlfLamping''
The cygwin tools are described in the developers guide, so it might be a better way to link to the developer's guide (and probably update it) and link from here instead of duplicating information in the wiki. The developer's guide was an attempt to provide detailed information about setting up a build environment. I don't know if another step-by-step guide is a good idea. - ''UlfLamping''

''__Some Notes on my experience using this page__''

My setup: Cygwin + all free tools.

 * Microsoft (R) Incremental Linker Version 7.10.3077
 * Microsoft (R) 32-bit C/C++ Standard Compiler Version 13.10.3077 for 80x86
Comments on the '''Setup''' section

I could not find '''C:\Program File\Microsoft SDK\!SetEnv.Bat'''.

I did find '''C:\Program File\Microsoft Platform SDK for Windows Server 2003 R2''''''\!SetEnv.Cmd '''which seems to do the same thing. I just added the following to /cygwin.bat:

{{{
call "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd"
call "C:\Program Files\Microsoft.NET\SDK\v1.1\Bin\sdkvars.bat"
}}}
Seemed easier than trying to edit the files provided by Microsoft.

By default Cygwin seems to put the MS PATH values at the end of the cygwin PATH variable. To make sure all SDK/Toolkit paths preceded my cygwin paths I just added the following to my .bash_profile. Saving the ORIGPATH is optional.

{{{
# Move MS compiler stuff to the front for Wireshark
ORIGPATH=$PATH
MSPATH="`echo $PATH | tr : '\n' | grep Microsoft | tr '\n' :`"
UPATH="`echo $PATH | tr : '\n' | grep -v Microsoft | tr '\n' :`"
PATH="`echo $MSPATH:$UPATH | sed -e s/::\*/:/ -e s/^:// -e s/:\$//`"
}}}
Currently I can build Wireshark, but it blows up while initializing dissectors. I'll add the solution to that when I find it... - ''AndrewFeren''

Building Wireshark On Windows

This page describes how Wireshark can be compiled with recent Microsoft compilers (Version 7 and higher):

The main line to compile Wireshark under Windows is still using Microsoft Visual C++ Version 6.

One of the reasons for this is that the myriad of [http://anonsvn.wireshark.org/wireshark-win32-libs/tags/ Win32 support lib] port projects all seem to believe there are legal issues involved in using newer versions of Visual Studio. This FUD essentially stems from two misconceptions:

  1. Unfortunately, it is believed by many that the Microsoft Visual Studio 2003 EULA explicitly forbids linking with GPL'ed programs. This belief is probably due to an improper interpretation of the [http://msdn.microsoft.com/visualc/vctoolkit2003/eula.aspx Visual Studio 2003 Toolkit EULA], which places redistribution restrictions only on SOURCE CODE SAMPLES which accompany the toolkit.

  2. Other maintainers believe that the GPL itself forbids using Visual Studio 2003, since one of the required support libraries (MSVCR71.DLL) does not ship with the Windows operating system. This is also a wrongful interpretation, and the [http://www.gnu.org/licenses/gpl-faq.html#WindowsRuntimeAndGPL GPL FAQ] explicitly addresses this issue.

So due to this, the build process under newer versions of the Microsoft build environment does not work "out of the box". However, with a little work it is not only possible to build Wireshark under Visual Studio 2003, but also under the combination of the freely available [http://www.microsoft.com/downloads/details.aspx?FamilyID=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en .NET Framework SDK] and the [http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ Platform SDK].

Prerequisites

Setup

If you intend to build from the free SDK components as opposed to Visual Studio 7, you will need to combine the two path/environment scripts. The way I did this was to edit C:\Program File\Microsoft SDK\SetEnv.Bat and append a call "C:\Program Files\Microsoft.NET\SDK\v1.1\Bin\sdkvars.bat" to the end.

Then you can add a call "C:\Program Files\Microsoft SDK\SetEnv.Bat" to your cygwin.bat startup script. Or, if you are just using VS7, add call "c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat" to cygwin.bat.

Make sure all SDK/Toolkit paths precede your cygwin paths. In particular, which link from within cygwin should give you the SDK version.

At this point you can run Anchor(setup)nmake -f Makefile.nmake setup from within the wireshark src dir. Once it downloads all the required libs, you should download zlib and compile it by running nmake -f win32/Makefile.msc. If you are using the free SDK toolkits, you will have to change the AR=lib line to AR=link /lib. Note that building zlib this way from source is required, even though binaries is provided. This seems to be due to some incompatibility with MSVCR71.DLL.

Once the build is complete, run

cp zdll* /cygdrive/c/wireshark-win32-libs/zlib123-dll/lib
cp zlib1.dll /cygdrive/c/wireshark-win32-libs/zlib123-dll/

If you are building under the SDK's, you will need to compile setargv.obj:

cd "/cygdrive/c/Program Files/Microsoft SDK/src/crt"
cl.exe /c /I. /D_CRTBLD setargv.c
mv setargv.obj ../../Lib

Hacking around compilation errors

At this point if you attempt to build, things may go smoothly for a while, but eventually you'll run into errors about the nonexistence of unistd.h. The windows equivalent to this header is io.h. Either go through all the files that include unistd.h and change it to io.h, or do the following:

cat > /cygdrive/c/Program\ Files/Microsoft\ Visual\ Studio\ .NET\ 2003/Vc7/include/unistd.h << EOF
#include <io.h>
EOF

You will most likely also run into problems with undefined symbols for errno, mb_curr_max and pctype. This can be solved by adding the following lines to the following files:

plugins/asn1/packet-asn1.c:

int __mb_cur_max;
const unsigned short* _pctype;
int errno;

plugins/mate/mate_plugin.c:

int errno;

plugins/mgcp/packet-mgcp.c:

int __mb_cur_max;
const unsigned short* _pctype;

You may also encounter linking problems caused by "bad" parameters in config.nmake. For example:

  • ... unresolved external symbol __imp__errno ... ... unresolved external symbol __imp__fseek ... ... unresolved external symbol __imp__strtoul ...

I replaced:

  • LOCAL_CFLAGS=/Zi /W3 with LOCAL_CFLAGS= /Zi /DWIN32 /W3

  • LOCAL_LDFLAGS=/DEBUG with LOCAL_LDFLAGS=/DEBUG /DEFAULTLIB:msvcrt /NODEFAULTLIB:libc

While compiling plugins, you might also encounter problems. For these plugins, in the Makefile.nmake file change

  • LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386 $(LOCAL_LDFLAGS)

by

  • LDFLAGS = /NOLOGO /INCREMENTAL:no /MACHINE:I386

This was not required by my build under the SDK, but others have reported needing it.

Building

The ideal way to build is to create an installer. Add the following to packaging/nsis/wireshark.nsi:

File "c:\program files\Microsoft Visual Studio .NET 2003\Common7\IDE\msvcr71.dll"

Then run nmake -f Makefile.nmake packaging

This will build an wireshark-setup executable that will install all the libs you need to run it.


Discussion

Should we split this page into separate pages for building with MSVC7 and the free tools?

Should someone attempt to create a step-by-step guide for compiling, or is that doomed to fail due to differences in system setup? Erik Sternerson

The cygwin tools are described in the developers guide, so it might be a better way to link to the developer's guide (and probably update it) and link from here instead of duplicating information in the wiki. The developer's guide was an attempt to provide detailed information about setting up a build environment. I don't know if another step-by-step guide is a good idea. - UlfLamping

Some Notes on my experience using this page

My setup: Cygwin + all free tools.

  • Microsoft (R) Incremental Linker Version 7.10.3077
  • Microsoft (R) 32-bit C/C++ Standard Compiler Version 13.10.3077 for 80x86

Comments on the Setup section

I could not find C:\Program File\Microsoft SDK\SetEnv.Bat.

I did find C:\Program File\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd which seems to do the same thing. I just added the following to /cygwin.bat:

call "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd"
call "C:\Program Files\Microsoft.NET\SDK\v1.1\Bin\sdkvars.bat"

Seemed easier than trying to edit the files provided by Microsoft.

By default Cygwin seems to put the MS PATH values at the end of the cygwin PATH variable. To make sure all SDK/Toolkit paths preceded my cygwin paths I just added the following to my .bash_profile. Saving the ORIGPATH is optional.

# Move MS compiler stuff to the front for Wireshark
ORIGPATH=$PATH
MSPATH="`echo $PATH | tr : '\n' | grep Microsoft | tr '\n' :`"
UPATH="`echo $PATH | tr : '\n' | grep -v Microsoft | tr '\n' :`"
PATH="`echo $MSPATH:$UPATH | sed -e s/::\*/:/ -e s/^:// -e s/:\$//`"

Currently I can build Wireshark, but it blows up while initializing dissectors. I'll add the solution to that when I find it... - AndrewFeren

Development/MSVC7 (last edited 2020-03-20 21:59:16 by GuyHarris)