Skip to content

Instantly share code, notes, and snippets.

@syneart
Last active February 13, 2024 14:45
  • Star 34 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
Star You must be signed in to star a gist
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/$(curl 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/$(curl 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
Copy link
Author

syneart commented Nov 20, 2018

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

syneart commented May 22, 2019

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

Copy link

ghost commented Jun 18, 2020

Thanks! I got it on my Chromebook lol

@syneart
Copy link
Author

syneart commented Jul 1, 2020

Thanks! I got it on my Chromebook lol

Glad to help.

@amaslenn
Copy link

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

syneart commented Nov 7, 2020

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

Avacee commented Nov 19, 2020

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

errord commented Jun 9, 2021

good job!

@syneart
Copy link
Author

syneart commented Jun 19, 2021

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

syneart commented Jun 19, 2021

good job!

Thank you, that's very kind of you!

@berkakinci
Copy link

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

syneart commented Sep 7, 2021

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

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

syneart commented Feb 19, 2022

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

thank u, indeed there is too much package to install

@syneart
Copy link
Author

syneart commented May 24, 2022

thank u, indeed there is too much package to install

Glad to help.

@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

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