1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
Build from sources
==================
This document describes the process to build ``bpfilter`` from sources. While ``bpfilter`` can be built on most systems, a recent (6.6+) Linux kernel is required with ``libbpf`` 1.2+ to run the ``bpfilter`` daemon. ``bpfilter`` officially supports Fedora 40+, CentOS Stream 9+, and Ubuntu 24.04+.
If you want to perform a full build of ``bpfilter`` (including all test tests, code check, benchmarks, and documentation), the following dependencies are required:
.. code-block:: shell
# Fedora 40+
sudo dnf -y install \
autoconf \
automake \
gawk \
bpftool \
bison \
clang \
clang-tools-extra \
cmake \
doxygen \
flex \
gcc \
gcc-c++ \
git-core \
google-benchmark-devel \
iproute \
iputils \
jq \
lcov \
libbpf-devel \
libcmocka-devel \
libgit2-devel \
libnl3-devel \
libtool \
procps-ng \
python3-breathe \
python3-dateutil \
python3-furo \
python3-GitPython \
python3-linuxdoc \
python3-scapy \
python3-sphinx \
sed \
xxd
# Ubuntu 24.04+
sudo apt-get install -y \
autoconf \
automake \
bison \
clang \
clang-tidy \
clang-format \
cmake \
doxygen \
flex \
furo \
g++ \
git \
iproute2 \
iputils-ping \
lcov \
libbenchmark-dev \
libbpf-dev \
libc-dev \
libcmocka-dev \
libgit2-dev \
libnl-3-dev \
libtool \
linux-tools-common \
make \
pkgconf \
procps \
python3-breathe \
python3-dateutil \
python3-git \
python3-pip \
python3-scapy \
python3-sphinx \
sed \
xxd
You can then use CMake to generate the build system:
.. code-block:: shell
cmake -S $BPFILTER_SOURCE -B $BUILD_DIRECTORY
The usual CMake options are allowed (e.g. ``CMAKE_BUILD_TYPE``, ``CMAKE_INSTALL_PREFIX``...). The build configuration is modular, so you're free to enable/disable some parts of the projects according to your needs:
- ``-DNO_DOCS``: disable the documentation, including the coverage and benchmarks report.
- ``-DNO_TESTS``: disable unit tests, end-to-end tests, and integration tests.
- ``-DNO_CHECKS``: disable style check and static analyzer.
- ``-DNO_BENCHMARKS``: disable benchmarks.
A full configuration (without any part disabled) will provide the following targets:
- ``core``, ``bpfilter``, ``libbpfilter``, ``bfcli``: the ``bpfilter`` binaries.
- ``test``, ``e2e``, ``integration``: the test suits. See :doc:`tests` for more information.
- ``check``: run ``clang-tidy`` and ``clang-format`` against the source files.
- ``benchmarks``: run the benchmarks on ``bpfilter``.
The build artifacts are located in ``$BUILD_DIRECTORY/output``.
|