Skip to main content
This guide walks through building the eBPF Event Interceptor from source, including setting up dependencies, configuring build options, and troubleshooting common issues.

Prerequisites

Before building, ensure you have the required dependencies installed.

System Requirements

  • Linux Kernel: 4.1 or newer with eBPF support
  • Build Tools: gcc, g++, make, cmake (3.10+)
  • BCC: BPF Compiler Collection (version varies by distribution)

Installing Build Dependencies

On Ubuntu 20.04 or newer:
CMake 3.10 or higher is required. Check your version with cmake --version.

Setting Up BCC

The BPF Compiler Collection (BCC) is required to compile eBPF programs.

Automatic Setup (Ubuntu)

The build system can automatically install BCC for Ubuntu systems:
If BCC is not found, the build system will run scripts/extended.sh to install it.

Manual BCC Installation

For other distributions or manual installation:
Then build and install BCC from source:
For detailed BCC installation instructions for your specific distribution, see the official BCC installation guide.

Building the Project

1

Clone the repository

2

Create build directory

3

Configure with CMake

Run CMake to configure the build:
You should see output like:
4

Build the libraries

Compile using all available CPU cores:
This builds:
  • libtcpEvent.so - TCP event interceptor
  • libudpEvent.so - UDP event interceptor
5

Install the libraries

Install to the default location (/opt/RealTimeKql/lib):
Output:

CMake Build Options

The build system supports several configuration options:

SETUP_TESTS

Enable building test programs:
With tests enabled, the build produces:
Test binaries are installed to /tmp:
  • /tmp/tcpEventTest
  • /tmp/udpEventTest
Tests are disabled by default (SETUP_TESTS=OFF). Enable them for development and testing.

Custom Installation Paths

To change installation directories, modify the CMakeLists.txt:
Or override during CMake configuration:

Build Output Structure

After a successful build, your build directory contains:

Compilation Flags

The build system uses strict compiler flags:
  • -Wall -Wextra: Enable comprehensive warnings
  • -Werror: Treat warnings as errors
  • -D_FILE_OFFSET_BITS=64: Enable large file support
  • -pthread: Enable POSIX threads
The -Werror flag means any compiler warnings will fail the build. This ensures code quality but may require fixes when using different compiler versions.

Build Troubleshooting

Error:
Solution: The build system will attempt automatic installation. If it fails:
  1. Install BCC manually (see Manual BCC Installation)
  2. Ensure BCC is in the system library path: ldconfig -p | grep bcc
  3. If installed to a custom location, set the library path:
Error:
Solution: Install a newer CMake:
Error:
Solution: Install pthread development files:
If you encounter warnings-as-errors:Option 1: Fix the warnings (recommended)Option 2: Temporarily disable -Werror in CMakeLists.txt:
Error:
Solution: Ensure BCC is built with the same LLVM version as your system:
Rebuild BCC if versions don’t match.
Error:
Solution: Use sudo for installation:
Or create the installation directory with appropriate permissions:

Verifying the Build

After installation, verify the libraries are correctly installed:
Expected output:
Check library dependencies:
Should show libbcc.so in the dependencies:

Rebuilding

To rebuild after making changes:
For a complete rebuild:

Development Workflow

For active development:
1

Build with tests enabled

2

Make code changes

Edit source files in tcpEvent/ or udpEvent/
3

Rebuild incrementally

4

Test your changes

Use make -j$(nproc) to use all CPU cores, or make -j$(nproc --ignore=1) to leave one core free for other tasks.

Cross-Platform Considerations

Kernel Headers

eBPF programs require kernel headers. Ensure they’re installed:

Architecture Support

The interceptor supports x86_64 architecture. For other architectures, you may need to:
  1. Adjust struct alignment in common.h
  2. Verify eBPF helper function compatibility
  3. Test thoroughly on your target platform

Next Steps

Testing

Learn how to run and create tests

TCP Monitoring

Start monitoring TCP connections

UDP Monitoring

Start monitoring UDP traffic

Contributing

Contribute to the project