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:scripts/extended.sh to install it.
Manual BCC Installation
For other distributions or manual installation:- Ubuntu 20.04
- Ubuntu 18.04
- Other Distributions
Building the Project
Build the libraries
Compile using all available CPU cores:This builds:
libtcpEvent.so- TCP event interceptorlibudpEvent.so- UDP event interceptor
CMake Build Options
The build system supports several configuration options:SETUP_TESTS
Enable building test programs:/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: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
Build Troubleshooting
BCC not found
BCC not found
Error:Solution: The build system will attempt automatic installation. If it fails:
- Install BCC manually (see Manual BCC Installation)
- Ensure BCC is in the system library path:
ldconfig -p | grep bcc - If installed to a custom location, set the library path:
CMake version too old
CMake version too old
Error:Solution: Install a newer CMake:
Missing pthread library
Missing pthread library
Error:Solution: Install pthread development files:
Compiler errors with -Werror
Compiler errors with -Werror
If you encounter warnings-as-errors:Option 1: Fix the warnings (recommended)Option 2: Temporarily disable
-Werror in CMakeLists.txt:LLVM version mismatch
LLVM version mismatch
Error:Solution: Ensure BCC is built with the same LLVM version as your system:Rebuild BCC if versions don’t match.
Permission denied during install
Permission denied during install
Error:Solution: Use Or create the installation directory with appropriate permissions:
sudo for installation:Verifying the Build
After installation, verify the libraries are correctly installed:libbcc.so in the dependencies:
Rebuilding
To rebuild after making changes:Development Workflow
For active development: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:- Adjust struct alignment in
common.h - Verify eBPF helper function compatibility
- 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