To compile Wireshark on Windows using the Microsoft C/C++ compiler, you'll need:
C compiler (cl.exe
)
Assembler (ml.exe
for 32-bit targets
and ml64.exe
for 64-bit targets)
Linker (link.exe
)
Make (nmake.exe
)
C runtime headers and libraries (e.g. stdio.h,
msvcrt.lib
)
Windows platform headers and libraries (e.g.
windows.h, WSock32.lib
)
HTML help headers and libraries (htmlhelp.h,
htmlhelp.lib
)
The official Wireshark 1.8.x releases are compiled using Microsoft Visual C++ 2010 SP1. The official 1.2, 1.4, and 1.6 releases are and were compiled using Microsoft Visual C++ 2008 SP1. Other past releases, including the 1.0 branch, were compiled using Microsoft Visual C++ 6.0. Using the release compilers is recommended for Wireshark development work. "Express Edition" compilers such as Visual C++ 2010 Express Edition SP1 can be used but any PortableApps or U3 packages you create with them will require the installation of a separate Visual C++ Redistributable package on any machine on which the PortableApps or U3 package is to be used. See “C-Runtime "Redistributable" Files” below for more details.
However, you might already have a different Microsoft C++ compiler installed. It should be possible to use any of the following with the considerations listed:
Compiler Package |
IDE / Debugger? |
Publicly available? |
SDK required? |
config.nmake: MSVC_VARIANT |
32-bit/64-bit |
set compiler PATH and alike settings with: |
Remarks |
Visual Studio 2005 |
Yes |
Commercial 1 |
No 2 |
MSVC2005 |
32-bit only |
Microsoft Visual Studio 8\VC\bin\vcvars32.bat |
- |
Visual C++ 2005 Express Edition |
Yes |
Free Download (link disappeared) |
Free Download (link disappeared) |
MSVC2005EE |
32-bit only |
Microsoft Visual Studio 8\VC\bin\vcvars32.bat |
|
Visual Studio 2008 |
Yes |
Commercial |
No 2 |
MSVC2008 |
32-bit only? |
Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat |
- |
Visual C++ 2008 Express Edition SP1 |
Yes |
No 2 |
MSVC2008EE |
32-bit only? |
Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat |
| |
Visual Studio 2010 |
Yes |
Commercial |
No 2 |
MSVC2010 |
32-bit |
Microsoft Visual Studio 10.0\VC\vcvarsall.bat x86 |
- |
64-bit |
Microsoft Visual Studio 10.0\VC\vcvarsall.bat x64 | ||||||
Visual C++ 2010 Express Edition (recommended) |
Yes |
No 2 |
MSVC2010EE |
32-bit |
Microsoft Visual Studio 10.0\VC\vcvarsall.bat x86 |
| |
Yes 3 |
64-bit |
Microsoft Visual Studio 10.0\VC\vcvarsall.bat x64 |
| ||||
.NET Framework 2.0 SDK 5 |
No |
Free Download (link disappeared) |
Free Download (link disappeared) |
DOTNET20 |
32-bit only? |
Microsoft.NET\SDK\v2.0\Bin\sdkvars.bat |
|
1no longer officially available, might still be available through the MSDN subscriptions
2as the SDK is already integrated in the package, you obviously don't need to install it and don't even need to call a separate environment setting batch file for the SDK!
3the Express Edition does not include compilers or assemblers that can generate 64-bit code; those are only included in the SDK
4vcredist_x86.exe
(3MB free download) is required to build
Wireshark-win32-1.10.x.exe
,
and vcredist_x64.exe
is required to build
Wireshark-win64-1.10.x.exe
,
The version of vcredist_x86.exe
or
vcredist_x64.exe
must
match the version for your compiler, including any service packs
installed for the compiler.
5MSDN remarks that the corresponding .NET runtime is required. It's currently unclear if the runtime needs to be installed for the C compiler to work - or is this only needed to compile / run .NET programs?!?
Please note: The following is not legal advice - ask your preferred lawyer instead! It's the authors view, but this view might be wrong!
The myriad of 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:
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 Visual Studio 2003 Toolkit EULA, which places redistribution restrictions only on SOURCE CODE SAMPLES which accompany the toolkit.
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 GPL FAQ explicitly addresses this issue.
Similar applies to Visual Studio 2005 and alike.
So in effect it should be perfectly legal to compile Wireshark and distribute / run it if it was compiled with any MSVC version > V6!
The following table gives an overview of the possible Microsoft toolchain variants and their specific C compiler versions "ordered by release date":
Compiler Package |
cl.exe |
_MSC_VER |
CRT DLL |
Visual Studio 2005 |
8.0 |
1400 |
msvcr80.dll |
Visual C++ 2005 Express Edition | |||
.NET Framework 2.0 SDK | |||
Windows SDK for Windows Vista and .NET Framework 3.0 Runtime Components | |||
Visual Studio 2008 |
9.0 |
1500 |
msvcr90.dll |
Visual Studio 2008 Express Edition | |||
Visual Studio 2010 |
10.0 |
1600 |
msvcr100.dll |
Visual Studio 2010 Express Edition |
After correct installation of the toolchain, typing at the command line prompt (cmd.exe):
>
cl
should result in something like:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corp. All rights reserved. usage: cl [ option... ] filename... [ /link linkoption...
However, the version string may vary.
nmake is part of the toolchain packages described above.
Instead of using the workspace (.dsw) and projects (.dsp) files, the traditional nmake makefiles are used. This has one main reason: it makes it much easier to maintain changes simultaneously with the GCC toolchain makefile.am files as both file formats are similar. However, as no Visual Studio workspace/project files are available, this makes it hard to use the Visual Studio IDE e.g. for using the integrated debugging feature.
After correct installation, typing at the command line prompt (cmd.exe):
>
nmake
should result in something like:
Microsoft (R) Program Maintenance Utility Version 6.00.9782.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. NMAKE : fatal error U1064: MAKEFILE not found and no target specified Stop.
However, the version string may vary.
Documentation on nmake can be found at Microsoft MSDN
Please note: The following is not legal advice - ask your preferred lawyer instead! It's the authors view, but this view might be wrong!
Depending on the Microsoft compiler version you use, some binary files coming from Microsoft might be required to be installed on Windows machine to run Wireshark. On a developer machine, the compiler setup installs these files so they are available - but they might not be available on a user machine!
This is especially true for the C runtime DLL (msvcr*.dll), which contains the implementation of ANSI and alike functions, e.g.: fopen(), malloc(). The DLL is named like: msvcr<version>.dll, an abbreviation for "MicroSoft Visual C Runtime". For Wireshark to work, this DLL must be available on the users machine.
Starting with MSVC7, it is necessary to ship the C runtime DLL (msvcr<version>.dll) together with the application installer somehow, as that DLL is possibly not available on the target system.
![]() | Note! |
---|---|
The files to redistribute must be mentioned in the redist.txt file of the compiler package - otherwise it can't be legally redistributed by third parties like us! |
The following MSDN links are recommended for the interested reader:
In all cases where vcredist_x86.exe
or
vcredist_x64.exe
is downloaded, it should
be downloaded to the directory into which the support libraries
for Wireshark have been downloaded and installed. This directory
is specified by the WIRESHARK_LIB_DIR setting in the
config.nmake
file; by default it is
C:\wireshark-win32-libs
. It need not, and
should not, be run after being downloaded.
There are three redistribution methods that MSDN mentions for MSVC 8 (see: "Choosing a Deployment Method"):
"Using Visual C++ Redistributable Merge Modules" (kind of loadable modules for building msi installers - not suitable for Wireshark's NSIS based installer)
"Using Visual C++ Redistributable Package", wherein
the Microsoft libraries are installed by copying
vcredist_x86.exe
,
vcredist_x64.exe
, or
vcredist_ia64.exe
to the target
machine and executing it on that machine (MSDN recommends
this for applications built with Visual Studio 2005
Express Edition)
"Install a particular Visual C++ assembly as a
private assembly for the application", wherein the
Microsoft libraries are installed by copying the folder
content of Microsoft.VC80.CRT
to
the target directory (e.g. C:\Program
Files\Wireshark
)
To save installer size, and to make a "portable"
version of Wireshark (which must be completely self-contained,
on a medium such as a flash drive, and not require that an
installer be run to install anything on the target machine)
possible, when building 32-bit Wireshark with MSVC2005, method
3 (copying the content of Microsoft.VC80.CRT
)
is used (this produces the smallest package).
As MSVC2005EE and DOTNET20 don't provide the folder
Microsoft.VC80.CRT
, when 32-bit Wireshark
is built with either of them method 2 is used.
You'll have to download the appropriate version of
vcredist_x86.exe
from Microsoft for your
compiler version.
A portable version of 64-bit Wireshark is not built, so method
3 is used for all 64-bit builds. You'll have to download the
appropriate version of vcredist_x64.exe
or vcredist_ia64.exe
from Microsoft
for your target processor and compiler version.
For 32-bit builds using Microsoft Visual C++ 2005 Express Edition without Service Pack 1, you need 8.0.50608.0, from: "Microsoft Visual C++ 2005 Redistributable Package (x86)": http://www.microsoft.com/download/details.aspx?id=3387.
For 64-bit x86 (x64) builds using Microsoft Visual C++ 2005, any edition, without Service Pack 1, you need {fill this in}, from: "Microsoft Visual C++ 2005 Redistributable Package (x64)": http://www.microsoft.com/download/details.aspx?id=21254.
For IA-64 builds using Microsoft Visual C++ 2005, any edition, without Service Pack 1, you need {fill this in}, from: "Microsoft Visual C++ 2005 Redistributable Package (IA64)": http://www.microsoft.com/download/details.aspx?id=16326.
For 32-bit builds using Microsoft Visual C++ 2005 Express Edition with Service Pack 1, you need 8.0.50727.762, from: "Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)": http://www.microsoft.com/download/details.aspx?id=5638.
For 64-bit x86 builds using Microsoft Visual C++ 2005, any edition, with Service Pack 1, you need {fill this in}, from: "Microsoft Visual C++ 2005 SP1 Redistributable Package (x64)": http://www.microsoft.com/download/details.aspx?id=18471.
Please report to the developer mailing list, if you find a different version number!
There are three redistribution methods that MSDN mentions for MSVC 9 (see: "Choosing a Deployment Method"):
"Using Visual C++ Redistributable Merge Modules" (kind of loadable modules for building msi installers - not suitable for Wireshark's NSIS based installer)
"Using Visual C++ Redistributable Package", wherein
the Microsoft libraries are installed by copying
vcredist_x86.exe
or
vcredist_x64.exe
to the target
machine and executing it on that machine (MSDN recommends
this for applications built with Visual Studio 2008
Express Edition)
"Install a particular Visual C++ assembly as a
private assembly for the application", wherein the
Microsoft libraries are installed by copying the folder
content of Microsoft.VC90.CRT
to
the target directory (e.g. C:\Program
Files\Wireshark
)
To save installer size, and to make a "portable"
version of Wireshark (which must be completely self-contained,
on a medium such as a flash drive, and not require that an
installer be run to install anything on the target machine)
possible, when building 32-bit Wireshark with MSVC2008, method
3 (copying the content of Microsoft.VC90.CRT
)
is used (this produces the smallest package).
As MSVC2008EE doesn't provide the folder
Microsoft.VC90.CRT
,
when 32-bit Wireshark is built with it method 2 is used.
You'll have to download the appropriate version of
vcredist_x86.exe
from Microsoft for your
compiler version.
A portable version of 64-bit Wireshark is not built, so method
2 is used for all 64-bit builds. You'll have to download the
appropriate version of vcredist_x64.exe
from Microsoft for your compiler version.
For 32-bit builds using Microsoft Visual C++ 2008 Express Edition without Service Pack 1, you need 9.0.21022.8, from: "Microsoft Visual C++ 2008 Redistributable Package (x86)": http://www.microsoft.com/download/details.aspx?id=29.
For 64-bit builds using Microsoft Visual C++ 2008, any edition, without Service Pack 1, you need 9.0.21022.8, from: "Microsoft Visual C++ 2008 Redistributable Package (x64)": http://www.microsoft.com/download/details.aspx?id=15336.
For 32-bit builds with Microsoft Visual C++ 2008 Express Edition with Service Pack 1, you need 9.0.30729.17, from: "Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)": http://www.microsoft.com/download/details.aspx?id=5582.
For 64-bit builds with Microsoft Visual C++ 2008, any edition, with Service Pack 1, you need 9.0.30729.17, from: "Microsoft Visual C++ 2008 SP1 Redistributable Package (x64)": http://www.microsoft.com/download/details.aspx?id=2092.
Please report to the developer mailing list, if you find a different version number!
There are three redistribution methods that MSDN mentions for MSVC 10 (see: "Choosing a Deployment Method"):
"Using Visual C++ Redistributable Package", wherein
the Microsoft libraries are installed by copying
vcredist_x86.exe
or
vcredist_x64.exe
to the target
machine and executing it on that machine (MSDN recommends
this for applications built with Visual Studio 2010,
both Express Edition and non-Express editions)
"Using Visual C++ Redistributable Merge Modules" (kind of loadable modules for building msi installers - not suitable for Wireshark's NSIS based installer)
"Install a particular Visual C++ assembly as a
private assembly for the application", wherein the
Microsoft libraries are installed by copying the folder
content of Microsoft.VC100.CRT
to
the target directory (e.g. C:\Program
Files\Wireshark
)
To save installer size, and to make a "portable"
version of Wireshark (which must be completely self-contained,
on a medium such as a flash drive, and not require that an
installer be run to install anything on the target machine)
possible, when building 32-bit Wireshark with MSVC2010, method
3 (copying the content of Microsoft.VC100.CRT
)
is used (this produces the smallest package).
As MSVC20010EE doesn't provide the folder
Microsoft.VC100.CRT
,
when 32-bit Wireshark is built with it method 1 is used.
You'll have to download the appropriate version of
vcredist_x86.exe
from Microsoft that
corresponds to your compiler version.
A portable version of 64-bit Wireshark is not built, so method
1 is used for all 64-bit builds. You'll have to download the
appropriate version of vcredist_x64.exe
from Microsoft for your compiler version.
For 32-bit builds using Microsoft Visual C++ 2010 Express Edition without Service Pack 1, you need 10.0.30319.1, from: "Microsoft Visual C++ 2010 Redistributable Package (x86)": http://www.microsoft.com/download/en/details.aspx?id=5555.
For 64-bit builds using Microsoft Visual C++ 2010, any edition, without Service Pack 1, you need 10.0.30319.1, from: "Microsoft Visual C++ 2010 Redistributable Package (x64)": http://www.microsoft.com/download/details.aspx?id=14632.
For 32-bit builds using Microsoft Visual C++ 2010 Express Edition with Service Pack 1, you need 10.0.40219.1, from: "Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)": http://www.microsoft.com/download/en/details.aspx?id=8328.
For 64-bit builds using Microsoft Visual C++ 2010, any edition, with Service Pack 1, you need 10.0.40219.1, from: "Microsoft Visual C++ 2010 SP1 Redistributable Package (x64)": http://www.microsoft.com/download/details.aspx?id=13523.
Please report to the developer mailing list, if you find a different version number!
The Windows Platform SDK (PSDK) or Windows SDK is a free (as in beer) download and contains platform specific headers and libraries (e.g. windows.h, WSock32.lib, ...). As new Windows features evolve in time, updated SDK's become available that include new and updated API's.
When you purchase a commercial Visual Studio, it will include an SDK. The free (as in beer) downloadable C compiler versions (VC++ 2005 Express, .NET Framework, ...) do not contain an SDK - you'll need to download a PSDK in order to have the required C header files and libraries.
Older versions of the SDK should also work. However, the command to set the environment settings will be different, try search for SetEnv.* in the SDK directory.
Prior to Windows Vista, the name "Platform SDK" was used; starting with Vista, the name was changed just to "Windows Software Development Kit" or "Windows SDK". The full names of the SDKs can be misleading; for example, the SDK for Vista was called the "Microsoft Windows Software Development Kit for Windows Vista and .NET Framework 3.0 Runtime Components", which really means the Windows SDK for Windows Vista and Platforms (like WinXP) that have the .NET 3.0 runtime installed.
The HTML Help is used to create the User's and Developer's Guide in .chm format and to show the User's Guide as the Wireshark "Online Help".
Both features are currently optional, but might be mandatory in future versions.
This compiler is used to generate a .chm file from a bunch of HTML files - in our case to generate the User's and Developer's Guide in .chm format.
The compiler is only available as the free (as in beer) "HTML Help Workshop" download. If you want to compile the guides yourself, you need to download and install this. If you don't install it into the default directory, you may also have a look at the HHC_DIR setting in the file docbook/Makefile.
The files htmlhelp.c and htmlhelp.lib are required to be able to open .chm files from Wireshark - to show the "online help".
Both files are part of the SDK (standalone (P)SDK or MSVC since 2002). If you still use MSVC 6, you can get them from the "HTML Help Workshop" mentioned above.
The related settings in config.nmake depend on the MSVC variant you use:
MSVC 6: if the "HTML Help Workshop" is installed, set HHC_DIR to its directory
> MSVC 6: set HHC_DIR to use it (the actual value doesn't matter in this case)
Well, using a good debugger can save you a lot of development time.
The debugger you use must match the C compiler Wireshark was compiled with, otherwise the debugger will simply fail or you will only see a lot of garbage.
You can use the integrated debugger of Visual Studio - only available in some of the toolchain packages.
However, setting up the environment is a bit tricky, as the Win32 build process is using makefiles instead of the .dsp/.dsw files usually used.
XXX - add instructions how to do it.
You could also use the Microsoft Debugging Tools for Windows toolkit, which is a standalone GUI debugger. Although it's not that comfortable compared to debugging with the Visual Studio integrated debugger, it can be helpful if you have to debug on a machine where an integrated debugger is not available.
You can get it free of charge at: http://www.microsoft.com/whdc/devtools/debugging/default.mspx (as links to Microsoft pages change from time to time, search for "Debugging Tools" at their page if this link should be outdated).