How to compile Wireshark source code on Windows

Source: Internet
Author: User
Tags using git

after a few days compiled Wireshark source of pain, record their own compilation of Wireshark experience, hope to be able to compile wireshark in the future people some help. This method is able to compile the latest Wireshark source code, and now some of the methods found online are old methods, compiling the latest wireshark is not feasible. I am referring to a document in English, if the person reading this document is not difficult, can be compiled in this English document description. Attached address:https://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html (if not open, may need to FQ)

Now the steps to compile Wireshark are detailed:

1, installation VS2013

The community version or the ultimate version of the line, please be sure to follow the default path to install , this can reduce a lot of trouble.  After the installation is complete, enter the command at the cmd command line :c:\> xcopy "C:\Program Files (x86) \microsoft Sdks\windows\v7.1a\include\win32.mak" C:\Program Files (x86) \microsoft Visual Studio 12.0\vc\include Note: Two paths should be enclosed in double quotation marks or there will be an error.

2. Install QT

Download the installation package, Qt-sdk-windows-x86-msvc2013_opengl. Note that if the msvc2013 version, please also follow the default path to install .

3, Installation Cygwin

Cygwin is installed online, in the choice of URL address can be selected, http://mirror.kenerl.org, if not select one can be installed on the line, in the selection of the installation package, note that you must install a few packages:

    • Archive/unzip (not needed if using CMake)
    • Devel/bison (or install Win flex-bison-see chocolatey below)
    • Devel/flex (or install Win flex-bison-see chocolatey below)
    • Devel/git (recommended-see discussion about using git below)
    • Interpreters/perl
    • Utils/patch (only if needed) (could be devel/patch instead)
    • Web/wget (not needed if using CMake)
    • AsciiDoc
    • Interpreters/m4

If you do not understand these packages, the Archive,devel,interpreters,utils,web will be installed in all the package. Note: The default path is also installed.

4. Install Python

This is simple, install PYTHON27, the default path is installed on the line.

5. Download Wireshark Source code

It's a good idea to download the latest Wireshark source on GitHub, or go to https://www.wireshark.org/download/src/all-versions/.

After downloading the source code, name it Wireshark, and create a new folder named development under the root of the C drive, and then store the Wireshark source in it.

6. Configuration related environment (most critical)

6.1, enter VS2013-"Visual studio Tools, and then open the x86 Native command line tool, do the environment settings

> Set cygwin=nodosfilewarning

> Set Wireshark_base_dir=c:\development

> Set Wireshark_target_platform=win32 (If your vs2013 is a 64-bit version, change to: Win64)

> Set qt5_base_dir=c:\qt\qt5.3.0\5.3\msvc2013 (Note the Qt version here, you may install the Qt5.3.2, modify it according to your own situation)

> Set Wireshark_version_extra=-yourextraversioninfo

6.2. Then go to the Wireshark directory

> CD C:\Development\wireshark

6.3. Verify the Installation tool:

> Nmake-f makefile.nmake verify_tools

If the following message appears, it's okay.

Microsoft (R) Program Maintenance Utility Version 12.00.21005.1Copyright (C) Microsoft Corporation.  All rights reserved.
Error:the contents of ' E:\Wireshark\Wireshark-win32-libs\current_tag.txt ' is (unknown). It should is 2014-10-01.checking for required applications:
CL:/cygdrive/c/program Files (x86)/microsoft Visual Studio 12.0/vc/bin/cl Link:/cygdrive/c/program files (x86)/mi Crosoft Visual Studio 12.0/vc/bin/link nmake:/cygdrive/c/program Files (x86)/microsoft Visual Studio 12.0/vc/bin/n Make bash:/usr/bin/bash Bison:/usr/bin/bison Flex:/usr/bin/flex env:/usr/bin/env GR EP:/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 C:\Qt\Qt5.3.0\5.3\msvc2013\bin\qmake:/cygdrive/c/qt/ Qt5.3.0/5.3/msvc2013/bin/qmake sed:/usr/bin/sed unzip:/usr/bin/unzip wget:/usr/bin/wget
Note: the "ERROR" can be ignored.

6.4. Installation Library
>Nmake-f makefile.nmake Setup
If no errors occur, proceed to the next step

6.5. Compiling Wireshark
>Nmake-f Makefile.nmake All
If there are no errors during the compilation process, congratulations on your successful compilation. A successful compilation generates two versions of the executable file, one of which is the QT version in:C:\Development\wireshark\wireshark-qt-release\Wireshark.exe。 另一个是老的GTK版本的: C:\Development\wireshark\wireshark-gtk2\Wireshark-gtk.exe.

注:如果编译过程中有出现什么错误,根据错误进行相应的修改,修改完后先执行命令
>
Nmake-f Makefile.nmake Distclean
and recompile
> Nmake-f Makefile.nmake All

General Summary:

1, this is to compile a new version of Wireshark encoding method, some online methods are aimed at the old version, this method I am pro-test feasible.

2, I hope that strict follow the step by step down, you can less detours, the above software must be installed by default path, you can reduce the trouble of modifying the path, not the default installation is OK, but to modify the path will encounter various problems, unless you are familiar with the source code of Wireshark.

3, the above installation is for 32-bit systems, 64-bit system is the same, only the corresponding software download 64-bit version.

4. If you are looking at the English version of the instructions that I provide, it provides an online installation method. However, it is recommended to download the installation package installation, online installation is generally not successful, and do not know why.

PS: The process of configuration compilation is very painful, but after the successful compilation, you will reap a lot, also wish you to compile Wireshark source code on the road, less detours.

How to compile Wireshark source code on Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.