Chapter 2. Quick Setup

Table of Contents

2.1. UNIX: Installation and Build Instructions
2.1.1. Build environment setup
2.1.2. Building
2.1.3. Optional: Install
2.1.4. Optional: Create User’s and Developer’s Guide
2.1.5. Optional: Create an installable or source code package
2.1.6. Troubleshooting during the build and install on Unix
2.2. Win32/64: Step-by-Step Guide
2.2.1. Recommended: Install Chocolatey
2.2.2. Install Microsoft Visual Studio
2.2.3. Install Qt
2.2.4. Install Python
2.2.5. Install Perl
2.2.6. Install Git
2.2.7. Install CMake
2.2.8. Install Asciidoctor, Xsltproc, And DocBook
2.2.9. Install winflexbison
2.2.10. Install and Prepare Sources
2.2.11. Open a Visual Studio Command Prompt
2.2.12. Generate the build files
2.2.13. Build Wireshark
2.2.14. Debug Environment Setup
2.2.15. Optional: Create User’s and Developer’s Guide
2.2.16. Optional: Create a Wireshark Installer

2.1. UNIX: Installation and Build Instructions

2.1.1. Build environment setup

The following must be installed in order to build Wireshark:

  • a C compiler and a C++ compiler;
  • the Flex lexical analyzer;
  • either Bison or Berkeley YACC;
  • Perl;
  • Python 3;
  • CMake;
  • several required libraries.

Either make or Ninja can be used to build Wireshark; at least one of those must be installed.

To build the Developer’s Guide and the User’s Guide, Asciidoctor, Xsltproc, and DocBook must be installed.

Some features of Wireshark require additional libraries to be installed.

For Debian, and for Linux distributions based on Debian, such as Ubuntu, the script tools/debian-setup.sh will install the packages and libraries required to build Wireshark. It supports the command-line options:

  • --install-optional to install additional tools and to install libraries required for all Wireshark features;
  • --install-deb-deps to install packages required to build a .deb file for Wireshark;
  • --install-test-deps to install packages required to run all tests.

For RPM-based Linux distributions such as Red Hat, Centos, Fedora, and openSUSE, the script tools/rpm-setup.sh will install the packages and libraries required to build Wireshark. It supports the command-line options:

  • --install-optional to install additional tools and to install libraries required for all Wireshark features;
  • --install-rpm-deps to install packages required to build a .rpm file for Wireshark.

For Alpine Linux, the script tools/alpine-setup.sh will install the packages and libraries required to build Wireshark. It supports the --install-optional command-line option to install additional tools and to install libraries required for all Wireshark features.

For FreeBSD, NetBSD, OpenBSD, and DragonFly BSD, the script tools/bsd-setup.sh will install the packages and libraries required to build Wireshark. It supports the --install-optional command-line option to install additional tools and to install libraries required for all Wireshark features.

For macOS, you must first install Xcode. After installing Xcode, the script tools/macos-setup.sh will install the rest of the tools and libraries required to build Wireshark, as well as the additional tools required to build the documentation and the libraries required for all Wireshark features. If you’re using Homebrew, the script tools/macos-setup-brew.sh will intall the same tools and libraries from Homebrew.

If an install package is not available or you have a reason not to use it (maybe because it’s simply too old), you can install that tool from source code. The following sections will provide you with the webpage addresses where you can get these sources.

2.1.2. Building

The recommended (and fastest) way to build Wireshark is with CMake and Ninja. Building with make took nearly 2x time as Ninja in one experiment.

CMake builds are best done in a separate build directory, such as a build subdirectory of the top-level source directory. If that directory is a subdirectory of the top-level source directory, to generate the build files, change to the build directory and enter the following command:

$ cmake ..

to use make as the build tool or

$ cmake -G Ninja ..

to use Ninja as the build tool. If you create the build tool in the same directory that contains the top-level Wireshark source directory, to generate the build files, change to the build directory and enter the following command:

$ cmake ../{source directory}

to use make as the build tool or

$ cmake -G Ninja ../{source directory}

to use Ninja as the build tool. {source directory} is the name of the top-level Wireshark source directory.

If you need to build with a non-standard configuration, you can run

$ cmake -LH ../{source directory}

to see what options you have.

You can then run Ninja or make to build Wireshark.

$ ninja
$ # or
$ make

Once you have build Wireshark with ninja or make above, you should be able to test it by entering run/wireshark.

2.1.3. Optional: Install

Install Wireshark in its final destination:

make install

Once you have installed Wireshark with make install above, you should be able to run it by entering wireshark.

2.1.4. Optional: Create User’s and Developer’s Guide

To build the Wireshark User’s Guide and the Wireshark Developer’s Guide build the all_guides target, e.g. make all_guides or ninja all_guides. Detailed information to build these guides can be found in the file docbook\README.adoc in the Wireshark sources.

2.1.5. Optional: Create an installable or source code package

To create a source code tarball, build the dist target.

To create an installable package after successfully building Wireshark:

  • to build a Debian package, build the deb-package target;
  • to build an RPM package, build the rpm-package target;
  • to build an AppImage package, build the appimage target;
  • to build a macOS dmg package containing am application bundle, build the dmg_package target.

2.1.6. Troubleshooting during the build and install on Unix

A number of errors can occur during the build and installation process. Some hints on solving these are provided here.

If the cmake stage fails you will need to find out why. You can check the file CMakeOutput.log and CMakeError.log in the build directory to find out what failed. The last few lines of this file should help in determining the problem.

The standard problems are that you do not have a required development package on your system or that the development package isn’t new enough. Note that installing a library package isn’t enough. You need to install its development package as well.

If you cannot determine what the problems are, send an email to the wireshark-dev mailing list explaining your problem. Include the output from cmake and anything else you think is relevant such as a trace of the make stage.