2.4. Windows: Cross-compilation using Linux

It is possible to compile Wireshark for Microsoft Windows using Linux and MinGW. This way developers can deploy Wireshark on Windows systems without requiring a Windows host machine. Building for Windows using a Linux host is also easier for devs already familiar with Linux, the build itself is faster and it uses a very mature C/C++ compiler (GCC) and debugger (GDB).

2.4.1. Using Fedora Linux

Fedora Linux provides the best out-of-the-box support for MinGW cross-compilation. Fedora is what the project uses to test the build and it’s what we recommend. While any other reasonably modern Linux distribution can be used, that will make the process more time consuming and involve some trial and error to setup.

The build instructions on Fedora follow the familiar recipe for building Wireshark using Linux.

2.4.1.1. Building from source

  1. Install needed dependencies:

    tools/mingw-rpm-setup.sh --install-all
  2. Build using CMake + Ninja:

    mkdir build && cd build
    mingw64-cmake -G Ninja -DENABLE_CCACHE=Yes -DFETCH_lua=Yes ..
    ninja

    Note that currently it is not possible to run the test-suite when cross-compiling.

  3. Build the NSIS installer

    ninja wireshark_nsis_prep
    ninja wireshark_nsis

If successful the installer can be found in $CMAKE_BINARY_DIR/packaging/nsis.

2.4.1.2. Notes and comparison with MSVC builds

  • Only the MSVCRT C library for Microsoft Windows can be used. Support for the UCRT (Universal C Runtime) library on Fedora Linux is in the initial stages of deployment and not ready for prime-time (at the time of this writing).
  • Some optional dependencies are missing from Fedora repositories and must be compiled from source if desired. An up-to-date complete list can be found in the bug tracker (issue 19108).
  • Lua does not have custom UTF-8 patches.
  • The Event Tracing for Windows (ETW) extcap cannot be compiled using MinGW-w64.
  • Enhanced Kerberos dissection with decryption is not available.
  • AirPcap is not supported.

2.4.2. Using Arch Linux

Arch Linux has good support for MinGW using packages from the AUR. Note that the mingw-w64 AUR packages sometimes break. If that happens you may be required to fix it or skip the package until it is fixed by the maintainer, if it’s an optional dependency. You may also want to consider using an unofficial user repository (such as the ownstuff repository) to provide pre-compiled packages. This will greatly simplify the initial setup and subsequent upgrades.

[Caution]Caution

AUR packages and unofficial user repositories are user-produced content. These packages are completely unofficial and have not been thoroughly vetted. It is your decision whether to trust their maintainers and you take full responsibility for choosing to use them.

You will need to install an AUR helper. This guide assumes paru is being used.

  1. Install required dependencies from official repositories:

    pacman -S mingw-w64 nsis lemon qt6-tools ccache
  2. Install required dependencies from the AUR:

    paru -S mingw-w64-cmake
    paru -S mingw-w64-glib2
    paru -S mingw-w64-libgcrypt
    paru -S mingw-w64-c-ares
    paru -S mingw-w64-speexdsp
    paru -S mingw-w64-libpcap
  3. Install Qt6:

    paru -S mingw-w64-qt6-base mingw-w64-qt6-5compat mingw-w64-qt6-multimedia
  4. Install optional dependencies:

    paru -S mingw-w64-gnutls
    paru -S mingw-w64-lz4
    paru -S mingw-w64-snappy
    paru -S mingw-w64-opus
    paru -S mingw-w64-opencore-amr
    paru -S mingw-w64-libxml2
    paru -S mingw-w64-libnghttp2
    paru -S mingw-w64-libssh
    paru -S mingw-w64-minizip

    Search the AUR for other dependencies not listed above.

  5. Build Wireshark using CMake + Ninja. From the directory containing the Wireshark source tree run:

    mkdir build && cd build
    x86_64-w64-mingw32-cmake -G Ninja -DENABLE_CCACHE=Yes -DFETCH_lua=Yes \
          -DMINGW_SYSROOT=/usr/x86_64-w64-mingw32 ..
    ninja

    This will automatically download and build Lua as a static library.

    To reconfigure the CMake build you may to do it explicitly by running x86_64-w64-mingw32-cmake . in the build directory, instead of letting ninja do it for you automatically.

  6. Build the NSIS installer

    ninja wireshark_nsis_prep
    ninja wireshark_nsis

If everything goes well the installer can be found in $CMAKE_BINARY_DIR/packaging/nsis.

The same notes as the build using Fedora apply.