1 <!-- WSDG Chapter Setup -->
4 <chapter id="ChapterSetup">
5 <title>Quick Setup</title>
6 <section id="ChSetupUNIX">
7 <title>UNIX: Installation</title>
8 <para>All the tools required are usually installed on a UNIX
9 developer machine.</para>
10 <para>If a tool is not already installed on your system, you
11 will typically use the installation package from your
12 distribution (by your favourite package manager: aptitude, yum,
13 synaptics, ...).</para>
14 <para>If an install package is not available, or you have a
15 reason not to use it (maybe because it's simply too old), you
16 can install that tool from source code. The following sections
17 will provide you with the webpage addresses where you can get
20 <section id="ChSetupWin32">
21 <title>Win32/64: Step-by-Step Guide</title>
22 <para>A quick setup guide for Win32 and Win64 with recommended
25 <title>Warning!</title>
27 <command>Unless you know exactly what you are doing, you
28 should strictly follow the recommendations!</command>
31 <section id="ChSetupMSVC">
32 <title>Install Microsoft C compiler and SDK</title>
33 <para>You need to install, in exactly this order:
37 <ulink url="http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express">
38 Download</ulink> and install "Microsoft Visual C++
39 2010 Express Edition." (This is a very large download.)</para>
42 <para>Windows SDK for Windows 7, if you want to build 64-bit
43 binaries for Windows 7:
44 <ulink url="http://msdn.microsoft.com/en-us/windowsserver/bb980924.aspx">
45 Download</ulink> and install "Microsoft Windows SDK for
47 <para>In case the install of the SDK fails go to software management and
48 remove the vc++2010 runtime and redist packages (don't worry, they
49 will be added back via the service pack later). If installation of
50 the SDK still fails, there may be a permission problem. See
51 <ulink url="http://ctrlf5.net/?p=184">here</ulink> how to resolve
55 <para>C compiler service pack:
56 <ulink url="http://www.microsoft.com/en-us/download/details.aspx?id=23691">
57 Download</ulink> and install "Microsoft Visual Studio 2010
58 Service Pack 1." (This is a very large download.)</para>
61 <para>Microsoft Visual C++ 2010 Service Pack 1 Compiler Update
62 for the Windows SDK 7.1, if you want to build 64-bit
63 binaries for Windows 7:
64 <ulink url="http://www.microsoft.com/en-us/download/details.aspx?id=4422">
65 Download</ulink> and install "Microsoft Visual C++ 2010
66 Service Pack 1 Compiler Update for the Windows SDK 7.1."</para>
71 <ulink url="http://www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB&displaylang=en">
72 Download</ulink>(420MB) and install "Microsoft Platform
73 SDK Server 2003 R2"</para>
77 <para>If you will be building 64-bit binaries, those items must be
78 installed in that order, as installing the Microsoft Visual Studio
79 2010 Service Pack 1 can, if you've installed the Microsoft Windows
80 SDK for Windows 7, remove the 64-bit compilers, as per
81 <ulink url="http://support.microsoft.com/?kbid=2519277">the
82 Microsoft Knowledge Base article "FIX: Visual C++ compilers are
83 removed when you upgrade Visual Studio 2010 Professional or Visual
84 Studio 2010 Express to Visual Studio 2010 SP1 if Windows SDK v7.1
85 is installed"</ulink>. The release notes for the Microsoft Visual
86 C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1
87 say that, to ensure that your system has a supported
88 configuration, you must install the items in the order specified
89 above. If you have Microsoft Update installed, so that the
90 Windows update process will update software other than components
91 of Windows, and thus will update Visual Studio, you may need to
92 disable it until after all of the above are installed, to make
93 sure it doesn't install Visual Studio 2010 SP1 out of order.</para>
95 <title>You can use other Microsoft C compiler variants!</title>
96 <para>It's possible to compile Wireshark with a wide range
97 of Microsoft C compiler variants. For details see
98 <xref linkend="ChToolsMSChain" />!</para>
101 <title>Don't use Cygwin's gcc!</title>
102 <para>Using Cygwin's gcc is not recommended and will
103 certainly not work (at least without a lot of advanced
104 tweaking). For further details on this topic, see
105 <xref linkend="ChToolsGNUChain" />.</para>
107 <para>XXX - mention the compiler and PSDK web installers -
108 which significantly reduce download size - and find out the
109 required components</para>
110 <para>Why is this recommended? While this is a huge download,
111 the 2010 Express Edition is the only free (as in beer)
112 version that includes the Visual Studio integrated
113 debugger. Visual C++ 2010 is also used to create official
114 Wireshark builds, so it will likely have fewer development-related
117 <section id="ChSetupCygwin">
118 <title>Install Cygwin</title>
120 <ulink url="http://www.cygwin.com/setup.exe">
121 Download</ulink> the Cygwin installer and start it.</para>
122 <para>At the "Select Packages" page, you'll need to select
123 some additional packages which are not installed by default.
124 Navigate to the required Category/Package row and, if the package
125 has a "Skip" item in the "New" column, click on the "Skip" item
126 so it shows a version number for:
129 <para>Archive/unzip</para>
132 <para>Base/dos2unix</para>
135 <para>Devel/bison</para>
138 <para>Devel/flex</para>
141 <para>Devel/subversion (optional - see discussion about using Subversion below)</para>
144 <para>Interpreters/perl</para>
147 <para>Utils/patch</para>
150 <para>Web/wget</para>
152 </itemizedlist></para>
153 <para>After clicking the Next button several times, the setup
154 will then download and install the selected packages (this
155 may take a while).</para>
156 <para>Why this is recommended: Cygwin's bash version is
157 required, as no native Win32 version is available. As
158 additional packages can easily be added, the perl and alike
159 packages are also used.</para>
161 <section id="ChSetupPython">
162 <title>Install Python</title>
163 <para>Get the Python 2.7 installer from:
164 <ulink url="http://python.org/download/" /> and install Python
165 into the default location (C:\Python27).</para>
166 <para>Why this is recommended: Cygwin's Python package
167 doesn't work on some machines, so the Win32 native package is
170 <section id="ChSetupsubversion">
171 <title>Install Subversion Client</title>
172 <para>Please note that the following is not required to build
173 Wireshark, but can be quite helpful when working with the
175 <para>Working with the Subversion source repositories is highly
176 recommended, see <xref linkend="ChSrcObtain" />. It is much easier
177 to update a personal source tree with Subversion rather than downloading
178 a zip file and merging new sources into a personal source tree
179 "by hand." It also makes first-time setup easy and enables
180 the Wireshark build process to determine your current source code
182 <para>There are several ways in which Subversion can be
185 <title>Subversion from Cygwin</title>
186 <para>Cygwin comes with a command-line Subversion client. To install
187 it, run Cygwin's setup.exe, navigate to Devel/subversion, and
188 if the package has a "Skip" item in the "New" column, click on the
189 "Skip" item so it shows a version number.</para>
192 <title>Subversion from apache.org</title>
193 <para>There are several binary-distribution Subversion clients
194 available from apache.org. Go to
195 <ulink url="http://subversion.apache.org/" /> and simply
199 <title>TortoiseSVN</title>
200 <para>TortoiseSVN is a native Windows graphical Subversion client for
201 Windows. You can download the setup from
202 <ulink url="http://tortoisesvn.net/" /> and simply
207 <title>Install and Prepare Sources</title>
209 <tip> <title>Tip</title>
210 <para>It's a good idea to successfully compile and run
211 Wireshark at least once before you start hacking the
212 Wireshark sources for your own project! This example uses TortoiseSVN
213 but another Subversion client would work as well.</para>
217 <para>Download sources : Download Wireshark sources into:
218 <filename>C:\wireshark</filename> using TortoiseSVN</para>
222 <para>right click on the C:\ drive in Windows
226 <para>in the upcoming context menu select "SVN
227 checkout..." and then set:</para>
233 <para>URL of repository: "
235 http://anonsvn.wireshark.org/wireshark/trunk/</literal>"</para>
238 <para>Checkout directory:
239 <filename>C:\wireshark</filename></para>
245 <para>TortoiseSVN might ask you to create this
246 directory - say yes</para>
249 <para>TortoiseSVN starts downloading the sources</para>
252 <para>if the download fails you may be behind a
253 restrictive firewall, see
254 <xref linkend="ChSrcObtain" /> for alternative
255 download methods</para>
261 <para>Edit config.nmake: edit the settings in
262 <filename>C:\wireshark\config.nmake</filename>, especially:</para>
266 <para><varname>VERSION_EXTRA</varname> : Give Wireshark your "private"
267 version info, e.g.: -myprotocol123 - to distinguish
268 it from an official release!</para>
271 <para><varname>PROGRAM_FILES</varname> : Where your programs reside,
272 usually just keep the default: <filename>C:\Program Files</filename>
273 <superscript>1</superscript></para>
276 <para><varname>MSVC_VARIANT</varname> : Make sure the variant for
278 uncommented, and that all others are commented out. For example,
279 if you're using Visual C++ 2010 Express Edition, find the line
281 <![CDATA[#MSVC_VARIANT=MSVC2010EE]]>
283 and remove the comment character (#)
284 from the beginning of the line. Then, find the line
286 <![CDATA[MSVC_VARIANT=MSVC2010]]>
288 and comment it out, by prefixing a hash (#).
289 <superscript>2</superscript></para>
295 <superscript>1</superscript>International Windows might use
296 different values here, e.g. a German version uses
297 <filename>C:\Programme</filename> - take this also in account where
298 <filename>C:\Program Files</filename> appears elsewhere.</para>
300 <superscript>2</superscript>Compiler dependent: This step
301 depends on the compiler you are using. For compilers other than
302 Visual C++ 2010, see the table at
303 <xref linkend="ChToolsMSChain" />.</para>
305 <section id="ChSetupPrepareCommandCom">
306 <title>Prepare cmd.exe</title>
307 <para>Prepare <filename>cmd.exe</filename> - set environment and current dir.
310 <para>start <command>cmd.exe</command></para>
314 <para>call "C:\Program Files\Microsoft Platform SDK for
315 Windows Server 2003 R2\SetEnv.Cmd" to set environment
316 variables of Platform SDK Server 2003 R2
317 <superscript>1,2</superscript></para>
321 <para>set environment variables for Visual C++ 2010 Express
322 Edition:<superscript>1,2</superscript></para>
323 <para>to build 32-bit binaries call
324 <command>"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86</command>
325 and to build 64-bit binaries call
326 <command>"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64</command></para>
327 <para>If your version of the compiler does not have <filename>SetEnv.Cmd</filename>, you
328 may need to use <filename>vcvarsall.bat</filename> or <filename>vcvars32.bat</filename>
329 which do much the same thing as <filename>SetEnv.cmd</filename>.</para>
331 For example, on some 64-bit installations, one would build a 32-bit version
333 <command>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat</command>
334 and one would build a 64-bit version using the command
335 <command>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Vcvarsall.bat amd64</command>
336 Consult your compiler's documentation to learn which version applies to your installation.</para>
339 <para>set environment variable to select target platform</para>
340 <para>to build 32-bit binaries execute
341 <command>set WIRESHARK_TARGET_PLATFORM=win32</command>
342 and to build 64-bit binaries execute
343 <command>set WIRESHARK_TARGET_PLATFORM=win64</command></para>
346 <para><command>cd C:\wireshark</command> to jump into the source
350 <superscript>1</superscript>International Windows might use
351 different values here, e.g. a German version uses
352 <filename>C:\Programme</filename> - take this also in account where
353 <filename>C:\Program Files</filename> appears elsewhere. Note: You need
354 to repeat steps 1 - 4 each time you open a new cmd.exe!</para>
355 <para><superscript>2</superscript>Compiler dependent: This step
356 depends on the compiler variant used, for other variants than
357 the recommended Visual C++ 2010 Express Edition see the table
359 <xref linkend="ChToolsMSChain" />!</para>
361 <para>Wireshark development depends on several additional
362 environment variables, particularly <varname>PATH</varname>.
363 You can use a batch script to fill these in, along with the Visual
364 C++ variables; for example:
369 if "%1" == "" goto x86
370 if /i %1 == x86 goto x86
371 if /i %1 == x64 goto x64
375 echo Error in script usage. The correct usage is:
377 echo where [option] is: x86 ^| x64
384 echo Adding things to the path...
385 set PATH=%PATH%;c:\cygwin\bin
386 set WIRESHARK_TARGET_PLATFORM=win64
387 call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64
388 title Command Prompt (VC++ 2010 x64)
392 echo Adding things to the path...
393 set PATH=%PATH%;c:\cygwin\bin
394 set WIRESHARK_TARGET_PLATFORM=win32
395 call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x86
396 title Command Prompt (VC++ 2010 -x86)
402 <section id="ChToolsWin32Verify">
403 <title>Verify installed tools</title>
404 <para>After you've installed the Wireshark sources (see
405 <xref linkend="ChSrcObtain" />), you can check the correct
406 installation of all tools by using the <parameter>verify_tools</parameter>
408 <filename>Makefile.nmake</filename> from the source package.</para>
410 <title>Warning!</title>
411 <para>You will need the Wireshark sources and some tools
412 (nmake, bash) installed, before this verification is able
415 <para>Enter at the command line (cmd.exe, not Cygwin's bash!):</para>
417 <prompt>></prompt>
418 <userinput>nmake -f Makefile.nmake verify_tools</userinput>
420 <para>This will check for the various tools needed to build Wireshark:</para>
423 <![CDATA[Checking for required applications:
424 cl: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/cl
425 link: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/link
426 nmake: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/nmake
428 bison: /usr/bin/bison
432 /usr/bin/find: /usr/bin/find
433 peflags: /usr/bin/peflags
435 C:\Python27\python.exe: /cygdrive/c/Python27/python.exe
437 unzip: /usr/bin/unzip
438 wget: /usr/bin/wget]]>
441 <para>If you have problems with all the first three items (cl, link, nmake),
442 check that you called <command>SetEnv.Cmd</command>
444 <xref linkend="ChSetupPrepareCommandCom" /> (which will "fix"
445 your <varname>PATH</varname> settings). However, the exact text will be slightly
446 different depending on the MSVC version used.</para>
447 <para>Unfortunately, the link command is defined both in
448 Cygwin and in MSVC each with completely different functionality;
449 you'll need the MSVC link. If your link command looks
450 something like: <command>/usr/bin/link</command>, the link command of Cygwin
451 takes precedence over the MSVC one. To fix this, you can
452 change your <varname>PATH</varname> environment setting or simply rename the
453 <filename>link.exe</filename> in Cygwin. If you rename it, make sure to remember
454 that a Cygwin update may provide a new version of it.</para>
455 <para>Make sure that the other tools found are the Cygwin versions. Some build
456 problems have been caused by incompatible versions of <command>grep</command> and
457 <command>unzip</command>.</para>
460 <title>Install Libraries</title>
463 <para>If you've closed <command>cmd.exe</command> in the meantime,
464 prepare <command>cmd.exe</command> again.</para>
467 <para><command>nmake -f Makefile.nmake setup</command> downloads libraries
468 using <command>wget</command> and installs them - this may take a while
472 <para>If the download fails you may be behind a
473 restrictive firewall, see the proxy comment in
474 <xref linkend="ChToolsWget"/>.</para>
477 <para>Note that 32-bit versions of the software require 32-bit versions of the
478 libraries and that 64-bit versions require 64-bit libraries. The build process
479 creates independent directories for each as needed. See
480 <xref linkend="ChSetupPrepareCommandCom" /> for how to use
481 <command>SetEnv.Cmd</command> and <varname>WIRESHARK_TARGET_PLATFORM</varname>
482 to select either a 32- or 64-bit build.</para>
485 <title>Distclean Sources</title>
486 <para>The released Wireshark sources contain files that are
487 prepared for a UNIX build (e.g. <filename>config.h</filename>).</para>
488 <para>You must distclean your sources before building the
492 <para>If you've closed <command>cmd.exe</command> in the meantime,
493 prepare <command>cmd.exe</command> again</para>
496 <para><command>nmake -f Makefile.nmake distclean</command>
497 to cleanup the Wireshark sources</para>
499 </orderedlist></para>
502 <title>Build Wireshark</title>
503 <para>Now it's time to build Wireshark ...
506 <para>If you've closed <command>cmd.exe</command> in the meantime,
507 prepare <command>cmd.exe</command> again</para>
510 <para><command>nmake -f Makefile.nmake all</command>
511 to build Wireshark</para>
514 <para>wait for Wireshark to compile - this may take a
518 <para>run <command>C:\wireshark\wireshark-gtk2\wireshark.exe</command>
519 and check if it starts</para>
522 <para>check Help/About if it shows your "private" program
523 version, e.g.: Version &WiresharkCurrentVersion;.x-myprotocol123
524 - you might run a release version previously installed!</para>
526 </orderedlist>Tip: If compilation fails for suspicious
527 reasons after you changed some source files try to "distclean"
528 the sources and make "all" again</para>
531 <title>Debug Environment Setup (XXX)</title>
532 <para>XXX - debug needs to be written, e.g. an idea is the
533 create a simple MSVC workspace/project(s) to ease Visual
534 Studio debugging</para>
537 <title>Optional: Create User's and Developer's Guide</title>
538 <para>Detailed information to build these guides can be found in the file
539 <filename>docbook/README.txt</filename> in the Wireshark sources.</para>
542 <title>Optional: Create a Wireshark Installer</title>
543 <para>Note: You should have successfully built Wireshark
544 before doing the following!</para>
545 <para>If you want to build your own
546 <filename>wireshark-win32-&WiresharkCurrentVersion;.x-myprotocol123.exe</filename>,
551 <ulink url="http://nsis.sourceforge.net">
552 Download</ulink> and install NSIS</para>
553 <para>You may check the <varname>MAKENSIS</varname> setting in the file
554 <filename>config.nmake</filename> of the Wireshark sources. Note that the
555 32-bit version of NSIS will work for both 32-bit and 64-bit versions of
559 <para>Runtime redistributable: to build a 32-bit version you will need
560 <filename>vcredist_x86.exe</filename> :
561 <ulink url="http://www.microsoft.com/en-us/download/details.aspx?id=8328">
562 Download</ulink> the C-Runtime redistributable for Visual
563 C++ 2010 Express Edition SP1 (<filename>vcredist_x86.exe</filename>)
564 and copy it into <filename>C:\wireshark-win32-libs</filename>
565 <superscript>1</superscript></para>
566 <para>To build a 64-bit version, you will need
567 <filename>vcredist_x64.exe</filename> :
568 <ulink url="http://www.microsoft.com/en-us/download/details.aspx?id=13523">
569 Download</ulink> the 64-bit redistributable for Visual C++ 2010 Express
570 Edition SP1 (<filename>vcredist_x64.exe</filename>) and copy it into
571 <filename>C:\Wireshark-win64-libs</filename><superscript>1</superscript>
575 <para>If you've closed <command>cmd.exe</command> in the meantime,
576 prepare <command>cmd.exe</command> again</para>
579 <para><command>nmake -f Makefile.nmake packaging</command>
580 build Wireshark installer</para>
584 <command>C:\wireshark\packaging\nsis\wireshark-win32-&WiresharkCurrentVersion;.x-myprotocol123.exe</command>
585 and test it - it's a good idea to test also on a different machine
586 than the developer machine.</para>
589 <superscript>1</superscript>Compiler dependent: This step
590 depends on the compiler variant used; for other variants than
591 the recommended Visual C++ 2010 Express Edition SP1 see the table
592 at <xref linkend="ChToolsMSChain" />!</para>