Skip to content

Instantly share code, notes, and snippets.

@syneart
Last active February 6, 2026 01:54
Show Gist options
  • Select an option

  • Save syneart/2d30c075c140624b1e150c8ea318a978 to your computer and use it in GitHub Desktop.

Select an option

Save syneart/2d30c075c140624b1e150c8ea318a978 to your computer and use it in GitHub Desktop.
BUILD WIRESHARK ON UBUNTU OR DEBIAN
#!/bin/sh
# This shell script is made by SyneArt <sa@syneart.com>
#######################################
# BUILD WIRESHARK ON UBUNTU OR DEBIAN #
#######################################
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |----------------------------------------------------------|
# | OS | Wireshark | Test | Last test |
# |--------------------|----------------|------|-------------|
# | Ubuntu 24.04 (Dev) | Commit:73c7fca | OK | 29 Jan 2024 |
# | Ubuntu 22.04.2 LTS | Commit:73c7fca | OK | 29 Jan 2024 |
# | Ubuntu 20.04.6 LTS | Commit:73c7fca | OK | 29 Jan 2024 |
# | Ubuntu 18.04.6 LTS | Commit:73c7fca | OK | 28 Jan 2024 |
# | Debian 12.4 | Commit:73c7fca | OK | 29 Jan 2024 |
# | Debian 11.8 | Commit:73c7fca | OK | 29 Jan 2024 |
# 1. KEEP UBUNTU OR DEBIAN 's apt-cache UP TO DATE
sudo apt-get update
export DEBIAN_FRONTEND=noninteractive
ln -fs /usr/share/zoneinfo/$(wget -qO - http://ip-api.com/line?fields=timezone) /etc/localtime
sudo apt-get install -y tzdata
# 2. INSTALL THE DEPENDENCIES
sudo apt-get install -y build-essential git cmake
# CMake3
sudo apt-get install -y cmake3
# CMake 3.13 or higher is required for Wireshark now
dpkg --compare-versions `cmake --version | head -1 | cut -f3 -d" "` lt 3.13 && {
sudo apt install -y software-properties-common
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
sudo apt-add-repository -y 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt install -y cmake
}
# GUI
sudo apt-get install -y qttools5-dev qttools5-dev-tools libqt5svg5-dev qtmultimedia5-dev
sudo apt-get install -y qt6-base-dev qt6-multimedia-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libqt6core5compat6-dev
# check qt6 backports, if need
apt-cache search qt6-multimedia-dev | grep qt6 >/dev/null || {
[ -e /etc/debian_version ] && {
# Debian bullseye-backports
# https://packages.debian.org/bullseye-backports/
echo "deb http://deb.debian.org/debian bullseye-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt install -y qt6-base-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools qt6-5compat-dev -t bullseye-backports
} || {
# Ubuntu qt6-backports
# https://launchpad.net/~okirby/+archive/ubuntu/qt6-testing
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:okirby/qt6-backports -y
sudo apt install -y libgl1-mesa-dev
sudo apt install -y qt6-base-dev qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools libqt6core5compat6-dev
}
}
# PCAP
sudo apt-get install -y libpcap-dev
# Dev file (On Ubuntu 20.04)
sudo apt-get install -y libc-ares-dev
# CRYPT
sudo apt-get install -y libgcrypt20-dev
# GLIB2
sudo apt-get install -y libglib2.0-dev
# LEX & YACC
sudo apt-get install -y flex bison
# PCRE2 (On Ubuntu 18.04)
sudo apt-get install -y libpcre2-dev
# HTTP/2 protocol (Ubuntu >= 16.04)
sudo apt-get install -y libnghttp2-dev
# HTTP/3 protocol (Ubuntu >= 22.04)
sudo apt-get install -y libnghttp3-dev
# SpeexDSP
sudo apt-get install -y libspeexdsp-dev
# 3. BUILD THE WIRESHARK
git clone https://github.com/wireshark/wireshark ~/wireshark
cd ~/wireshark
sed -i '15 a #include <stdint.h>' capture/capture_ifinfo.h
mkdir build
cd build
cmake ../
make -j`nproc` && {
echo "\nBuild Success!"
echo "You can execute the Wireshark by command \"sudo ./wireshark\""
echo "at \"`pwd`/run\""
}
#!/bin/sh
# This shell script is made by SyneArt <sa@syneart.com>
#######################################
# BUILD WIRESHARK ON UBUNTU OR DEBIAN #
#######################################
# | THIS SCRIPT IS TESTED CORRECTLY ON |
# |------------------------------------------------------|
# | OS | Wireshark | Test | Last test |
# |----------------|----------------|------|-------------|
# | Ubuntu 20.04.1 | Commit:a679ae6 | OK | 05 Nov 2020 |
# | Ubuntu 18.04.1 | Commit:a679ae6 | OK | 20 Nov 2018 |
# | Ubuntu 16.04.5 | Commit:a679ae6 | OK | 20 Nov 2018 |
# | Ubuntu 14.04.5 | Commit:a679ae6 | OK | 20 Nov 2018 |
# | Debian 9.6 | Commit:a679ae6 | OK | 20 Nov 2018 |
# 1. KEEP UBUNTU OR DEBIAN 's apt-cache UP TO DATE
sudo apt-get update
export DEBIAN_FRONTEND=noninteractive
ln -fs /usr/share/zoneinfo/$(wget -qO - http://ip-api.com/line?fields=timezone) /etc/localtime
sudo apt-get install -y tzdata
# 2. INSTALL THE DEPENDENCIES
sudo apt-get install -y build-essential git cmake
# CMAKE3
sudo apt-get install -y cmake3
# GUI
sudo apt-get install -y qttools5-dev qttools5-dev-tools libqt5svg5-dev qtmultimedia5-dev
# PCAP
sudo apt-get install -y libpcap-dev
# Dev file (On Ubuntu 20.04)
sudo apt-get install -y libc-ares-dev
# CRYPT
sudo apt-get install -y libgcrypt20-dev
# GLIB2
sudo apt-get install -y libglib2.0-dev
# LEX & YACC
sudo apt-get install -y flex bison
# 3. BUILD THE WIRESHARK
git clone https://github.com/wireshark/wireshark ~/wireshark_f1ap_r15_2_1
cd ~/wireshark_f1ap_r15_2_1
git checkout a679ae6 # F1AP R15.2.1
mkdir build
cd build
cmake -DDISABLE_WERROR=true ../ # g++
make -j`nproc` && {
echo "\nBuild Success!"
echo "You can execute the Wireshark by command \"sudo ./wireshark\""
echo "at \"`pwd`/run\""
}
@syneart

syneart commented Nov 20, 2018

Copy link
Copy Markdown
Author

Use below command to build the latest Wireshark on your own operating system.
wget -O - https://gist.githubusercontent.com/syneart/2d30c075c140624b1e150c8ea318a978/raw/build_wireshark.sh | sh

@syneart

syneart commented May 22, 2019

Copy link
Copy Markdown
Author

Use below command to build the Wireshark with F1AP R15.2.1 on your own operating system.
wget -O - https://gist.githubusercontent.com/syneart/2d30c075c140624b1e150c8ea318a978/raw/build_wireshark_F1AP_R15_2_1.sh |sh

ghost commented Jun 18, 2020

Copy link
Copy Markdown

Thanks! I got it on my Chromebook lol

@syneart

syneart commented Jul 1, 2020

Copy link
Copy Markdown
Author

Thanks! I got it on my Chromebook lol

Glad to help.

@amaslenn

Copy link
Copy Markdown

Great instruction, thank you!

On Ubuntu 20.04 (WSL edition) I've got the following issue: missing: CARES_LIBRARY CARES_INCLUDE_DIR.
Fixed by installing libc-ares-dev package.

@syneart

syneart commented Nov 7, 2020

Copy link
Copy Markdown
Author

Great instruction, thank you!

On Ubuntu 20.04 (WSL edition) I've got the following issue: missing: CARES_LIBRARY CARES_INCLUDE_DIR.
Fixed by installing libc-ares-dev package.

Thanks for the information.

@Avacee

Avacee commented Nov 19, 2020

Copy link
Copy Markdown

Hi syneart

Many thanks for this. You've restored my sanity after finding the wireshark docs lacking such simple instructions.

For those who want to use Lua scripts the lua-dev library must be installed - normal/non-dev lua won't work.
Note: Although Lua 5.3 is released it is not compatible with wireshark (as at 19/11/2020) but 5.2 is.
sudo apt-get -y install liblua5.2-dev

As all plugins (including Lua) are disabled when wireshark is invoked using sudo this can not be used.
However, a non-root user does not have the appropriate privileges to the dumpcap file so the following is needed:
sudo setcap cap_net_raw,cap_net_admin+eip ~/wireshark/build/run/dumpcap
Tested Ubuntu 20.04.1 LTS.

@errord

errord commented Jun 9, 2021

Copy link
Copy Markdown

good job!

@syneart

syneart commented Jun 19, 2021

Copy link
Copy Markdown
Author

Hi syneart

Many thanks for this. You've restored my sanity after finding the wireshark docs lacking such simple instructions.

For those who want to use Lua scripts the lua-dev library must be installed - normal/non-dev lua won't work.
Note: Although Lua 5.3 is released it is not compatible with wireshark (as at 19/11/2020) but 5.2 is.
sudo apt-get -y install liblua5.2-dev

As all plugins (including Lua) are disabled when wireshark is invoked using sudo this can not be used.
However, a non-root user does not have the appropriate privileges to the dumpcap file so the following is needed:
sudo setcap cap_net_raw,cap_net_admin+eip ~/wireshark/build/run/dumpcap
Tested Ubuntu 20.04.1 LTS.

You're right! I really appreciate you noticing that.

@syneart

syneart commented Jun 19, 2021

Copy link
Copy Markdown
Author

good job!

Thank you, that's very kind of you!

@berkakinci

Copy link
Copy Markdown

Thank you! It's a shame I couldn't find a simple list of dependencies in the Wireshark build instructions... This list of apt installs got me building in no time.

@syneart

syneart commented Sep 7, 2021

Copy link
Copy Markdown
Author

Thank you! It's a shame I couldn't find a simple list of dependencies in the Wireshark build instructions... This list of apt installs got me building in no time.

It's my pleasure!

@heurekus

Copy link
Copy Markdown

Add the following apt install to make Wireshark decode HTTP/2:

# This lib is required for http2 decoding. Needs to be installed before compile
sudo apt install libnghttp2-dev

@syneart

syneart commented Feb 19, 2022

Copy link
Copy Markdown
Author

Add the following apt install to make Wireshark decode HTTP/2:

# This lib is required for http2 decoding. Needs to be installed before compile
sudo apt install libnghttp2-dev

Thanks for reminding, already updated!

@RainnyNightLover

Copy link
Copy Markdown

thank u, indeed there is too much package to install

@syneart

syneart commented May 24, 2022

Copy link
Copy Markdown
Author

thank u, indeed there is too much package to install

Glad to help.

@joergdeutschmann-i7

Copy link
Copy Markdown

There is a script in the official Wireshark repository

Setup development environment on Debian and derivatives such as Ubuntu
https://github.com/wireshark/wireshark/blob/master/tools/debian-setup.sh

@berkakinci

Copy link
Copy Markdown

There is a script in the official Wireshark repository

Since I originally used this script myself, I started a bug to fix the state of proper documentation. We've updated user/dev guides so that you could find that script, and have only one complete set of instructions linked from:
https://www.wireshark.org/docs/wsug_html_chunked/ChapterBuildInstall.html

@syneart

syneart commented Jul 6, 2022

Copy link
Copy Markdown
Author

There is a script in the official Wireshark repository

Since I originally used this script myself, I started a bug to fix the state of proper documentation. We've updated user/dev guides so that you could find that script, and have only one complete set of instructions linked from: https://www.wireshark.org/docs/wsug_html_chunked/ChapterBuildInstall.html

Thanks for the information.

@syneart

syneart commented Jul 6, 2022

Copy link
Copy Markdown
Author

There is a script in the official Wireshark repository

Setup development environment on Debian and derivatives such as Ubuntu
https://github.com/wireshark/wireshark/blob/master/tools/debian-setup.sh

Thanks for the information.

@tnn4

tnn4 commented May 15, 2023

Copy link
Copy Markdown

Got missing: SPEEXDSP_LIBRARY.

Fixed with sudo apt-get install -y libspeexdsp-dev.

@syneart

syneart commented May 24, 2023

Copy link
Copy Markdown
Author

Got missing: SPEEXDSP_LIBRARY.

Fixed with sudo apt-get install -y libspeexdsp-dev.

Thanks for the information, already updated!

@anuragranjaninfineon

Copy link
Copy Markdown

How to resolve this
/usr/bin/ld: /usr/local/lib/libnl-genl-3.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status

@syneart

syneart commented Mar 2, 2024

Copy link
Copy Markdown
Author

How to resolve this /usr/bin/ld: /usr/local/lib/libnl-genl-3.so: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status

It seems that there is a mismatch between the instruction set architecture of the file and the system's instruction set architecture.
Uninstall or remove /usr/local/lib/libnl-genl-3.so first,
and use this command sudo apt install libnl-route-3-dev libnl-genl-3-dev to install the NL library, the NL library can be found when Wireshark execute cmake command.

@Chapoly1305

Copy link
Copy Markdown

Thank you. The wireshark somehow just won't build on my Ubuntu 22.04, but your script work just fine. Big saver.
BTW, the curl is used but not installed. Perhaps add to apt install list.

@syneart

syneart commented Jul 3, 2024

Copy link
Copy Markdown
Author

Thank you. The wireshark somehow just won't build on my Ubuntu 22.04, but your script work just fine. Big saver. BTW, the curl is used but not installed. Perhaps add to apt install list.

Thanks for reminding, already updated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment