This guide covers installing the BPF Compiler Collection (BCC) from source on Ubuntu 24.04 inside a Python virtual environment, including troubleshooting common installation issues.
Make sure your system is Ubuntu 24.04 or similar.
Update and install system packages:
sudo apt update && sudo apt upgrade -y
sudo apt install -y unzip zip bison build-essential cmake flex git libedit-dev \
libllvm18 llvm-18-dev libclang-18-dev python3 zlib1g-dev libelf-dev libfl-dev python3-setuptools \
liblzma-dev libdebuginfod-dev arping netperf iperf libpolly-18-dev libcurl4-openssl-dev libluajit-5.1-dev
These packages are needed for building BCC and its dependencies.
If you've attempted installation before and want to start clean, remove these folders and files:
rm -rf ~/JamJar/bcc rm -rf ~/JamJar/python-ptrace-0.9.9 rm -rf ~/JamJar/0.9.9.zip rm -rf ~/JamJar/jamjar-venv
git clone https://github.com/hashedalgorithm/JamJar.git
cd JamJar
python3 -m venv jamjar-venv
source jamjar-venv/bin/activate
This ensures that Python bindings for BCC are installed in an isolated environment.
git clone https://github.com/iovisor/bcc.git
cd bcc
If you’re using a virtual machine or ran git clone with sudo, you may need to change the folder’s ownership:
sudo chown -R $(whoami):$(whoami) .
mkdir build
cd build
pip install six setuptools ipcalc build
⚠️ If permission or dependency errors arise, check folder ownership and your virtual environment activation.
cmake ..
make -j$(nproc)
sudo make install
Note: sudo is needed here because installing to /usr/lib requires root permissions.
From within the build directory:
cd ../bcc
cmake -DPYTHON_CMD=python3 .
cd src/python
make -j$(nproc)
python3 setup.py install
⚠️ Important: Do NOT run sudo make install here; the Python bindings must install in the virtual environment.
Activate your virtual environment and run:
python3 -c "from bcc import BPF; print('✅ BCC Python bindings installed!')"
If this prints without errors, BCC is ready to use.
🤩 Tip : Check the make logs and verify that everything is installed correctly
Cause: version.py file missing in bcc/ directory.
Fix: Create a version.py in bcc/ with the following content:
__version__ = "0.35.0"
Confirm your current directory is the root of BCC Python source (bcc/src/python/) when running Python commands.
Cause: You need root permission to install shared libraries into /usr/lib.
Fix: Use sudo make install during core BCC installation.
Cause: Folder ownership issues or missing dependencies.
Fix: Ensure the entire BCC repo directory is owned by your user:
sudo chown -R $(whoami):$(whoami) ~/JamJar/bcc
Make sure your Python virtual environment is activated before installing.
Cause: Bash interprets ! as history expansion.
Fix: Use single quotes instead of double quotes or escape !:
python3 -c 'from bcc import BPF; print("✅ BCC installed!")'
JamJar needs su permissions to work hence it handles with kernal operations. even if you try to run it sudo it doesn't work. Hence we need root shell. To obtain root shell in ubuntu
- Set root password:
sudo passwd root
- Switch to root shell:
su
- Navigate to JamJar, activate venv and run:
cd ~/JamJar
source jamjar-venv/bin/activate
python3 main.py
⚠️ If you came across any error like module not found try to install it using pip(except for bcc and ptrace).
If you no longer need the source or build artifacts:
sudo rm -rf ~/JamJar/bcc