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 5 and 40 (spanning 35 versions)
Revision 5 as of 2005-03-11 00:13:38
Size: 5494
Editor: outgoing
Comment:
Revision 40 as of 2020-03-20 21:59:16
Size: 7513
Editor: GuyHarris
Comment: I love Wikis - you get to shift gears to a different link syntax every time you change which Wiki you're editing!
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Building Ethereal On Windows = = Building Wireshark using Microsoft VC 7 and above =
Line 3: Line 3:
'''The main line to compile Ethereal under Windows is still using Microsoft Visual Studio Version 6.''' '''The info on this page is now '''''obsolete'''''; none of the compilers listed here are still used to build Wireshark releases or supported by the Wireshark build process. [[https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html|Section 2.2 "Win32/64: Step-by-Step Guide" ]] in the [[https://www.wireshark.org/docs/wsdg_html_chunked/|Wireshark Developer's Guide]] contains detailed information on building Wireshark with newer versions of Visual Studio.'''
Line 5: Line 5:
The reason for this is that the myriad of [http://anonsvn.ethereal.com/ethereal-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: This page describes how Wireshark can be compiled with recent Microsoft compilers (Version 7 and higher):
Line 7: Line 7:
 1. Unfortunately, it is believed by many that the Microsoft Visual Studio 2k3 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 2k3 Toolkit EULA], which places redistribution restrictions only on SOURCE CODE SAMPLES which accompany the toolkit.  * Visual C++ .NET 2002 (C++ 7.0)
 * Visual C++ .NET 2003 (C++ 7.1)
 * Visual C++ .NET 2005 (C++ 8.0) (Express Edition [[http://msdn.microsoft.com/vstudio/express/visualc/|free download]])
 * .NET Framework SDK 1.0 (C++ 7.0)
 * .NET Framework SDK 1.1 (C++ 7.1) ([[http://www.microsoft.com/downloads/details.aspx?FamilyID=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en|free download]])
 * .NET Framework 2.0 SDK (C++ 8.0) ([[http://www.microsoft.com/downloads/details.aspx?FamilyID=fe6f2099-b7b4-4f47-a244-c96d69c35dec&DisplayLang=en|free download]])
Line 9: Line 14:
 1. Other maintainers believe that the GPL itself forbids using Visual Studio 2k3, 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. For the different Studios, see: ([[http://en.wikipedia.org/wiki/Microsoft_Visual_Studio]])
Line 11: Line 16:
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 Ethereal under Visual Studio 2k3, 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]. 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.

 1. 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.

The build process under newer versions of the Microsoft build environment should work "out of the box" now.
Line 14: Line 25:
 * [http://www.microsoft.com/downloads/details.aspx?FamilyID=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en .NET Framework SDK]
 * [http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ Platform SDK]
 * [http://www.cygwin.com Flex, bison and python, preferably from Cygwin]
 * [http://www.zlib.net Zlib 1.2.2 source]
Follow the common installation guidelines from the Developer Guide first: [[http://www.wireshark.org/docs/wsdg_html_chunked/ChToolsInstallWin32.html|Win32: Installation]]

 * [[http://www.microsoft.com/downloads/details.aspx?FamilyID=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en|.NET Framework SDK]] command-line compiler, linker, ...
 * [[http://www.microsoft.com/msdownload/platformsdk/sdkupdate/|Platform SDK]] nmake, header files, ... (you will need a Microsoft Internet Explorer 5.0 or later to download this)

'''Support for MSVC7 and above was significantly improved since 0.99.4 was released. You'll need the latest Wireshark sources (SVN version 20413 or above) for the following to work!!!'''
Line 20: Line 33:
First of all, edit '''config.nmake''' in the wireshark src dir and find the '''MSVC_VARIANT''' setting that best suits your compiler (MSVC 6 is still the default). Uncomment the corresponding MSVC_VARIANT= line. For example, if you use the .NET Framework SDK 1.1 this should look like:
Line 21: Line 35:
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. {{{
# "Microsoft .Net Framework SDK Version 1.1" - WORKS
# needs additional Platform SDK installation
# Visual C++ 7.1, _MSC_VER 1310, msvcr71.dll
MSVC_VARIANT=DOTNET11}}}
Line 23: Line 41:
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. If you intend to build from the free SDK components as opposed to Visual Studio 7, you will need to call the two path/environment scripts for the .NET SDK and the Plaform SDK. One way to do this is to edit your '''cygwin.bat''' startup script and add:
Line 25: Line 43:
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 {{{nmake -f Makefile.nmake setup}}} from within the ethereal src dir. Once it downloads all the required libs, you should download zlib 1.2.2 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}}}.

Once the build is complete, run
Line 32: Line 44:
cp zdll* /cygdrive/c/ethereal-win32-libs/zlib122-dll/lib
cp zlib1.dll /cygdrive/c/ethereal-win32-libs/zlib122-dll/
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"
Line 36: Line 48:
If you are building under the SDK's, you will need to compile setargv.obj:
{{{
cd "/cygdrive/c/Program Files/Microsoft DSK/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:
Or, if you are just using VS7, add :
Line 48: Line 51:
cat > /cygdrive/c/Program\ Files/Microsoft\ Visual\ Studio\ .NET\ 2003\Vc7\include\unistd.h << EOF
#include <io.h>
EOF
}}}
call "c:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\vsvars32.bat"}}} 
Line 53: Line 53:
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: 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.
Line 55: Line 55:
'''plugins/asn1/packet-asn1.c''':
{{{
int __mb_cur_max;
const unsigned short* _pctype;
int errno;
}}}
At this point you can run <<Anchor(setup)>>{{{nmake -f Makefile.nmake setup}}} from within the wireshark src dir.
Line 62: Line 57:
'''plugins/mate/mate_plugin.c''':
{{{
int errno;
}}}
== Compilation ==
At this point you should cleanup things first (removing UNIX related config.h and alike) by running:
Line 67: Line 60:
'''plugins/mgcp/packet-mgcp.c''':
{{{
int __mb_cur_max;
const unsigned short* _pctype;
}}}
{{{nmake -f Makefile.nmake distclean}}}
Line 73: Line 62:
Then you can start building with:
Line 74: Line 64:
You may also encounter linking problems caused by "bad" parameters in config.nmake. {{{nmake -f Makefile.nmake all}}}
Line 76: Line 66:
I replaced:
 * {{{LOCAL_CFLAGS=/Zi /W3 by LOCAL_CFLAGS= /Zi /DWIN32 /W3}}}
 * {{{LOCAL_LDFLAGS=/DEBUG by LOCAL_LDFLAGS=/DEBUG /DEFAULTLIB:msvcrt /NODEFAULTLIB:libc}}}
== Build Installer ==
The ideal way to build is to create an installer.
Line 80: Line 69:
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}}}
To build an installer that works on all target platforms, you need a redistributable msvcr*.dll. Unfortunately, it's only part of the commercial Visual Studio versions - it's not part of the free packages.
Line 86: Line 71:
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/ethereal.nsi''':

{{{
File "c:\program files\Microsoft Visual Studio .NET 2003\Common7\IDE\msvcr71.dll"
}}}
 * VC++ 2002, VC++ 2003, VC++ 2005, VC++ 2005 SP1: included
 * .NET SDK 2.0 and VC++ 2005 Express (pre-SP1): download [[http://www.microsoft.com/downloads/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en|vcredist_x86.exe]] and copy this exe into the C:\wireshark-win32-libs folder
 * .NET SDK 1.0 and .NET SDK 1.1: no redistributables available - you cannot build an installer!
Line 98: Line 77:
This will build an ethereal-setup executable that will install all the libs you need to run it. This will build a wireshark-setup executable that will install all the libs you need to run it.
Line 100: Line 79:
--------------------------------- XXX - is there a known source to get msvcr70.dll or msvcr71.dll from, which can be - legally - redistributed?
Line 102: Line 81:
This wiki entry was based upon [http://thread.gmane.org/gmane.network.ethereal.devel/12491 this mailinglist thread]. ----------
 . This wiki entry was based upon [[http://thread.gmane.org/gmane.network.wireshark.devel/12491|this mailinglist thread]].
== Discussion ==
Can someone knowledgeable add a section about how to compile a dissector ? ''Manfred Nelles''

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

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 using Microsoft VC 7 and above

The info on this page is now obsolete; none of the compilers listed here are still used to build Wireshark releases or supported by the Wireshark build process. Section 2.2 "Win32/64: Step-by-Step Guide" in the Wireshark Developer's Guide contains detailed information on building Wireshark with newer versions of Visual Studio.

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

  • Visual C++ .NET 2002 (C++ 7.0)
  • Visual C++ .NET 2003 (C++ 7.1)
  • Visual C++ .NET 2005 (C++ 8.0) (Express Edition free download)

  • .NET Framework SDK 1.0 (C++ 7.0)
  • .NET Framework SDK 1.1 (C++ 7.1) (free download)

  • .NET Framework 2.0 SDK (C++ 8.0) (free download)

For the different Studios, see: (http://en.wikipedia.org/wiki/Microsoft_Visual_Studio)

One of the reasons for this is that 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:

  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 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 GPL FAQ explicitly addresses this issue.

The build process under newer versions of the Microsoft build environment should work "out of the box" now.

Prerequisites

Follow the common installation guidelines from the Developer Guide first: Win32: Installation

  • .NET Framework SDK command-line compiler, linker, ...

  • Platform SDK nmake, header files, ... (you will need a Microsoft Internet Explorer 5.0 or later to download this)

Support for MSVC7 and above was significantly improved since 0.99.4 was released. You'll need the latest Wireshark sources (SVN version 20413 or above) for the following to work!!!

Setup

First of all, edit config.nmake in the wireshark src dir and find the MSVC_VARIANT setting that best suits your compiler (MSVC 6 is still the default). Uncomment the corresponding MSVC_VARIANT= line. For example, if you use the .NET Framework SDK 1.1 this should look like:

# "Microsoft .Net Framework SDK Version 1.1" - WORKS
# needs additional Platform SDK installation
# Visual C++ 7.1, _MSC_VER 1310, msvcr71.dll
MSVC_VARIANT=DOTNET11

If you intend to build from the free SDK components as opposed to Visual Studio 7, you will need to call the two path/environment scripts for the .NET SDK and the Plaform SDK. One way to do this is to edit your cygwin.bat startup script and add:

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"

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 nmake -f Makefile.nmake setup from within the wireshark src dir.

Compilation

At this point you should cleanup things first (removing UNIX related config.h and alike) by running:

nmake -f Makefile.nmake distclean

Then you can start building with:

nmake -f Makefile.nmake all

Build Installer

The ideal way to build is to create an installer.

To build an installer that works on all target platforms, you need a redistributable msvcr*.dll. Unfortunately, it's only part of the commercial Visual Studio versions - it's not part of the free packages.

  • VC++ 2002, VC++ 2003, VC++ 2005, VC++ 2005 SP1: included
  • .NET SDK 2.0 and VC++ 2005 Express (pre-SP1): download vcredist_x86.exe and copy this exe into the C:\wireshark-win32-libs folder

  • .NET SDK 1.0 and .NET SDK 1.1: no redistributables available - you cannot build an installer!

Then run nmake -f Makefile.nmake packaging

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

XXX - is there a known source to get msvcr70.dll or msvcr71.dll from, which can be - legally - redistributed?


Discussion

Can someone knowledgeable add a section about how to compile a dissector ? Manfred Nelles

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

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)