Skip to content

Instantly share code, notes, and snippets.

@syneart
Last active December 16, 2024 01:48
Show Gist options
  • Save syneart/2d30c075c140624b1e150c8ea318a978 to your computer and use it in GitHub Desktop.
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\""
}
@joergdeutschmann-i7
Copy link

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

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
Copy link
Author

syneart commented Jul 6, 2022

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
Copy link
Author

syneart commented Jul 6, 2022

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
Copy link

tnn4 commented May 15, 2023

Got missing: SPEEXDSP_LIBRARY.

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

@syneart
Copy link
Author

syneart commented May 24, 2023

Got missing: SPEEXDSP_LIBRARY.

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

Thanks for the information, already updated!

@anuragranjaninfineon
Copy link

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
Copy link
Author

syneart commented Mar 2, 2024

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

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
Copy link
Author

syneart commented Jul 3, 2024

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