A quick setup guide for Win32 with recommended configuration. This guide also describes how to build 64-bit versions.
![]() | Warning! |
---|---|
Unless you know exactly what you are doing, you should strictly follow the recommendations! |
You need to install, in exactly this order:
C compiler: Download and install "Microsoft Visual C++ 2010 Express Edition." (This is a very large download.)
Windows SDK for Windows 7, if you want to build 64-bit binaries for Windows 7: Download and install "Microsoft Windows SDK for Windows 7."
C compiler service pack: Download and install "Microsoft Visual Studio 2010 Service Pack 1." (This is a very large download.)
Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1, if you want to build 64-bit binaries for Windows 7: Download and install "Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1."
If you will be building 64-bit binaries, those items must be installed in that order, as installing the Microsoft Visual Studio 2010 Service Pack 1 can, if you've installed the Microsoft Windows SDK for Windows 7, remove the 64-bit compilers, as per the Microsoft Knowledge Base article "FIX: Visual C++ compilers are removed when you upgrade Visual Studio 2010 Professional or Visual Studio 2010 Express to Visual Studio 2010 SP1 if Windows SDK v7.1 is installed". The release notes for the Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1 say that, to ensure that your system has a supported configuration, you must install the items in the order specified above. If you have Microsoft Update installed, so that the Windows update process will update software other than components of Windows, and thus will update Visual Studio, you may need to disable it until after all of the above are installed, to make sure it doesn't install Visual Studio 2010 SP1 out of order.
![]() | You can use other Microsoft C compiler variants! |
---|---|
It's possible to compile Wireshark with a wide range of Microsoft C compiler variants. For details see Section 4.4, “Microsoft compiler toolchain (Win32 native)”! |
![]() | Don't use Cygwin's gcc! |
---|---|
Using Cygwin's gcc is not recommended and will certainly not work (at least without a lot of advanced tweaking). For further details on this topic, see Section 4.3, “GNU compiler toolchain (UNIX or Win32 Cygwin)”. |
XXX - mention the compiler and PSDK web installers - which significantly reduce download size - and find out the required components
Why is this recommended? While this is a huge download, the 2010 Express Edition is the only free (as in beer) version that includes the Visual Studio integrated debugger. Visual C++ 2010 is also used to create official Wireshark builds, so it will likely have fewer development-related problems.
Download the Cygwin installer and start it.
At the "Select Packages" page, you'll need to select some additional packages which are not installed by default. Navigate to the required Category/Package row and, if the package has a "Skip" item in the "New" column, click on the "Skip" item so it shows a version number for:
Archive/unzip
Archive/zip (only needed if you intend to build the U3 package)
Devel/bison
Devel/flex
Devel/subversion (optional - see discussion about using Subversion below)
Interpreters/perl
Utils/patch
Web/wget
After clicking the Next button several times, the setup will then download and install the selected packages (this may take a while).
Why this is recommended: Cygwin's bash version is required, as no native Win32 version is available. As additional packages can easily be added, the perl and alike packages are also used.
Get the Python 2.7 installer from: http://python.org/download/ and install Python into the default location (C:\Python27).
Why this is recommended: Cygwin's Python package doesn't work on some machines, so the Win32 native package is recommended.
Please note that the following is not required to build Wireshark, but can be quite helpful when working with the sources.
Working with the Subversion source repositories is highly recommended, see Section 3.3, “Obtain the Wireshark sources”. It is much easier to update a personal source tree with Subversion rather than downloading a zip file and merging new sources into a personal source tree "by hand." It also makes first-time setup easy and enables the Wireshark build process to determine your current source code revision.
There are several ways in which Subversion can be installed:
Cygwin comes with a command-line Subversion client. To install it, run Cygwin's setup.exe, navigate to Devel/subversion, and if the package has a "Skip" item in the "New" column, click on the "Skip" item so it shows a version number.
There are several binary-distribution Subversion clients available from apache.org. Go to http://subversion.apache.org/ and simply install one.
TortoiseSVN is a native Windows graphical Subversion client for Windows. You can download the setup from http://tortoisesvn.net/ and simply install it.
![]() | Tip |
---|---|
It's a good idea to successfully compile and run Wireshark at least once before you start hacking the Wireshark sources for your own project! This example uses TortoiseSVN but another Subversion client would work as well. |
Download sources : Download Wireshark sources into:
C:\wireshark
using TortoiseSVN
right click on the C:\ drive in Windows Explorer
in the upcoming context menu select "SVN checkout..." and then set:
URL of repository: "
http://anonsvn.wireshark.org/wireshark/trunk/
"
Checkout directory:
C:\wireshark
TortoiseSVN might ask you to create this directory - say yes
TortoiseSVN starts downloading the sources
if the download fails you may be behind a restrictive firewall, see Section 3.3, “Obtain the Wireshark sources” for alternative download methods
Edit config.nmake: edit the settings in
C:\wireshark\config.nmake
, especially:
VERSION_EXTRA
: Give Wireshark your "private"
version info, e.g.: -myprotocol123 - to distinguish
it from an official release!
PROGRAM_FILES
: Where your programs reside,
usually just keep the default: C:\Program Files
1
MSVC_VARIANT
: Make sure the variant for
your compiler is
uncommented, and that all others are commented out. For example,
if you're using Visual C++ 2010 Express Edition, find the line
#MSVC_VARIANT=MSVC2010EE
and remove the comment character (#) from the beginning of the line. Then, find the line
MSVC_VARIANT=MSVC2010
and comment it out, by prefixing a hash (#). 2
1International Windows might use
different values here, e.g. a German version uses
C:\Programme
- take this also in account where
C:\Program Files
appears elsewhere.
2Compiler dependent: This step depends on the compiler you are using. For compilers other than Visual C++ 2010, see the table at Section 4.4, “Microsoft compiler toolchain (Win32 native)”.
Prepare cmd.exe
- set environment and current dir.
start cmd.exe
set environment variables for Visual C++ 2010 Express Edition:1,2
to build 32-bit binaries call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 and to build 64-bit binaries call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64
If your version of the compiler does not have SetEnv.Cmd
, you
may need to use vcvarsall.bat
or vcvars32.bat
which do much the same thing as SetEnv.cmd
.
For example, on some 64-bit installations, one would build a 32-bit version by invoking C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat and one would build a 64-bit version using the command C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Vcvarsall.bat amd64 Consult your compiler's documentation to learn which version applies to your installation.
set environment variable to select target platform
to build 32-bit binaries execute set WIRESHARK_TARGET_PLATFORM=win32 and to build 64-bit binaries execute set WIRESHARK_TARGET_PLATFORM=win64
cd C:\wireshark to jump into the source directory
1International Windows might use
different values here, e.g. a German version uses
C:\Programme
- take this also in account where
C:\Program Files
appears elsewhere. Note: You need
to repeat steps 1 - 4 each time you open a new cmd.exe!
2Compiler dependent: This step depends on the compiler variant used, for other variants than the recommended Visual C++ 2010 Express Edition see the table at Section 4.4, “Microsoft compiler toolchain (Win32 native)”!
Wireshark development depends on several additional
environment variables, particularly PATH
.
You can use a batch script to fill these in, along with the Visual
C++ variables; for example:
@echo off if "%1" == "" goto x86 if /i %1 == x86 goto x86 if /i %1 == x64 goto x64 goto usage :usage echo Error in script usage. The correct usage is: echo %0 [option] echo where [option] is: x86 ^| x64 echo: echo For example: echo %0 x86 goto :eof :x64 echo Adding things to the path... set PATH=%PATH%;c:\cygwin\bin set WIRESHARK_TARGET_PLATFORM=win64 call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 title Command Prompt (VC++ 2010 x64) goto :eof :x86 echo Adding things to the path... set PATH=%PATH%;c:\cygwin\bin set WIRESHARK_TARGET_PLATFORM=win32 call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86 title Command Prompt (VC++ 2010 -x86) goto :eof
After you've installed the Wireshark sources (see
Section 3.3, “Obtain the Wireshark sources”), you can check the correct
installation of all tools by using the verify_tools
target of the
Makefile.nmake
from the source package.
![]() | Warning! |
---|---|
You will need the Wireshark sources and some tools (nmake, bash) installed, before this verification is able to work. |
Enter at the command line (cmd.exe, not Cygwin's bash!):
>
nmake -f Makefile.nmake verify_tools
This will check for the various tools needed to build Wireshark:
Checking for required applications: cl: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/cl link: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/link nmake: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/nmake bash: /usr/bin/bash bison: /usr/bin/bison flex: /usr/bin/flex env: /usr/bin/env grep: /usr/bin/grep /usr/bin/find: /usr/bin/find peflags: /usr/bin/peflags perl: /usr/bin/perl C:\Python27\python.exe: /cygdrive/c/Python27/python.exe sed: /usr/bin/sed unzip: /usr/bin/unzip wget: /usr/bin/wget
If you have problems with all the first three items (cl, link, nmake),
check that you called SetEnv.Cmd
as mentioned in
Section 2.2.6, “Prepare cmd.exe” (which will "fix"
your PATH
settings). However, the exact text will be slightly
different depending on the MSVC version used.
Unfortunately, the link command is defined both in
Cygwin and in MSVC each with completely different functionality;
you'll need the MSVC link. If your link command looks
something like: /usr/bin/link, the link command of Cygwin
takes precedence over the MSVC one. To fix this, you can
change your PATH
environment setting or simply rename the
link.exe
in Cygwin. If you rename it, make sure to remember
that a Cygwin update may provide a new version of it.
Make sure that the other tools found are the Cygwin versions. Some build problems have been caused by incompatible versions of grep and unzip.
If you've closed cmd.exe in the meantime, prepare cmd.exe again.
nmake -f Makefile.nmake setup downloads libraries using wget and installs them - this may take a while ...
If the download fails you may be behind a restrictive firewall, see the proxy comment in Section 4.15, “Win32: GNU wget (optional)”.
Note that 32-bit versions of the software require 32-bit versions of the
libraries and that 64-bit versions require 64-bit libraries. The build process
creates independent directories for each as needed. See
Section 2.2.6, “Prepare cmd.exe” for how to use
SetEnv.Cmd and WIRESHARK_TARGET_PLATFORM
to select either a 32- or 64-bit build.
The released Wireshark sources contain files that are
prepared for a UNIX build (e.g. config.h
).
You must distclean your sources before building the first time!
If you've closed cmd.exe in the meantime, prepare cmd.exe again
nmake -f Makefile.nmake distclean to cleanup the Wireshark sources
Now it's time to build Wireshark ...
If you've closed cmd.exe in the meantime, prepare cmd.exe again
nmake -f Makefile.nmake all to build Wireshark
wait for Wireshark to compile - this may take a while!
run C:\wireshark\wireshark-gtk2\wireshark.exe and check if it starts
check Help/About if it shows your "private" program version, e.g.: Version 1.10.x-myprotocol123 - you might run a release version previously installed!
Tip: If compilation fails for suspicious reasons after you changed some source files try to "distclean" the sources and make "all" again
XXX - debug needs to be written, e.g. an idea is the create a simple MSVC workspace/project(s) to ease Visual Studio debugging
Detailed information to build these guides can be found in the file
docbook/README.txt
in the Wireshark sources.
Note: You should have successfully built Wireshark before doing the following!
If you want to build your own
wireshark-win32-1.10.x-myprotocol123.exe
,
you'll need NSIS.
NSIS: Download and install NSIS
You may check the MAKENSIS
setting in the file
config.nmake
of the Wireshark sources. Note that the
32-bit version of NSIS will work for both 32-bit and 64-bit versions of
Wireshark.
Runtime redistributable: to build a 32-bit version you will need
vcredist_x86.exe
:
Download the C-Runtime redistributable for Visual
C++ 2010 Express Edition SP1 (vcredist_x86.exe
)
and copy it into C:\wireshark-win32-libs
1
To build a 64-bit version, you will need
vcredist_x64.exe
:
Download the 64-bit redistributable for Visual C++ 2010 Express
Edition SP1 (vcredist_x64.exe
) and copy it into
C:\Wireshark-win64-libs
1
If you've closed cmd.exe in the meantime, prepare cmd.exe again
nmake -f Makefile.nmake packaging build Wireshark installer
run C:\wireshark\packaging\nsis\wireshark-win32-1.10.x-myprotocol123.exe and test it - it's a good idea to test also on a different machine than the developer machine.
1Compiler dependent: This step depends on the compiler variant used; for other variants than the recommended Visual C++ 2010 Express Edition SP1 see the table at Section 4.4, “Microsoft compiler toolchain (Win32 native)”!