Building on Unix-like systems

This doc covers:

Make sure you have all required dependencies installed for your system. See this page for common requirements.

Clone and build (CMake)

git clone https://github.com/PurpleI2P/i2pd.git
cd i2pd
mkdir -p build && cd build
cmake <cmake options> ..
cmake --build . -j

…or the quick-and-dirty way with plain make:

cd i2pd/
make

Run tests:

cd i2pd/tests/
make

Install after a successful build:

sudo make install

CMake Options

Pass options as -D<key>=<value> (see man 1 cmake):

  • CMAKE_BUILD_TYPE build profile (Debug/Release, default: none)
  • WITH_BINARY build i2pd (default: ON)
  • WITH_LIBRARY build libi2pd (default: ON)
  • WITH_STATIC build static lib and binary (default: OFF)
  • WITH_UPNP build with UPnP (requires miniupnpc, default: OFF)
  • WITH_AESNI build with AES-NI (default: ON)
  • WITH_HARDENING enable hardening (GCC/Clang, default: OFF)
  • WITH_MESHNET build for cjdns test net (not for main net, default: OFF)
  • WITH_ADDRSANITIZER enable ASan (default: OFF)
  • WITH_THREADSANITIZER enable TSan (default: OFF)

List cached options:

cmake -L

Debian/Ubuntu

Tools:

sudo apt install build-essential debhelper cmake

Libraries:

sudo apt install \
  libboost-program-options-dev \
  libssl-dev \
  zlib1g-dev

UPnP (optional):

sudo apt install libminiupnpc-dev

Build a .deb:

sudo apt install fakeroot devscripts dh-apparmor
cd i2pd
debuild --no-tgz-check -us -uc -b

(UPnP dev package name: libminiupnpc-dev.)

Arch/Manjaro

Tools:

sudo pacman -S --needed base-devel cmake

Libraries:

sudo pacman -S --needed boost openssl zlib

Fedora/RHEL/CentOS Stream

Tools:

sudo dnf install make cmake gcc gcc-c++

Libraries:

sudo dnf install boost-devel openssl-devel zlib-devel atomic

UPnP (optional):

sudo dnf install miniupnpc-devel

Static builds (optional):

sudo dnf install boost-static

(UPnP/Boost static package names: miniupnpc-devel, boost-static. On some RHEL-like systems you may need to enable EPEL/CRB.)

macOS

Requires Homebrew and Xcode Command Line Tools.

Install deps:

brew install boost openssl@3 cmake make   

Build:

make HOMEBREW=1 -j8

Install to system root (/):

sudo make install HOMEBREW=1

Install to the Homebrew prefix (Intel /usr/local, Apple Silicon /opt/homebrew):

sudo make install HOMEBREW=1 PREFIX="$(brew --prefix)"

FreeBSD

Use the base compiler (Clang). Install tools and libraries as root:

pkg install boost-libs cmake gmake

UPnP (optional):

pkg install miniupnpc

Build with GNU make if using the BSD Makefile path:

gmake

(Note: FreeBSD ships OpenSSL and zlib in the base system; you don’t need extra SSL packages.)

OpenBSD

Use the base compiler (Clang). Install tools and libraries as root:

pkg_add boost cmake gmake

UPnP (optional):

pkg_add miniupnpc

Build with GNU make if using the BSD Makefile path:

gmake

(Note: OpenBSD ships LibreSSL and zlib in the base system; you don’t need extra SSL packages.)

Solaris/OpenIndiana

Install required packages:

pkg install developer/gcc-14
pkg install developer/build/cmake
pkg install system/library/boost
pkg install developer/build/gnu-make

Then use gmake if invoking Makefiles directly.

(Modern OpenIndiana provides GCC 14; package FMRIs like developer/gcc-14 and system/library/boost follow IPS naming.)