The build is currently tested on GNU/Linux, macOS, and Windows.
# Install dependencies
sudo apt install pkg-config libncurses5-dev libreadline-dev nettle-dev libgnutls28-dev libargon2-dev libmsgpack-dev libssl-dev libfmt-dev libjsoncpp-dev libhttp-parser-dev libasio-dev libmsgpack-cxx-dev
# Install Python binding dependencies
sudo apt-get install cython3 python3-dev python3-setuptools python3-buildOptionally, install RESTinio to enable the OpenDHT proxy client and server:
mkdir /usr/include/nonstd
wget https://raw.githubusercontent.com/martinmoene/expected-lite/master/include/nonstd/expected.hpp -O /usr/include/nonstd/expected.hpp
wget https://github.com/Stiffstream/restinio/releases/download/v.0.7.9/restinio-0.7.9.tar.bz2
tar -xjf restinio-0.7.9.tar.bz2
cd restinio-0.7.9/dev
cmake -DCMAKE_INSTALL_PREFIX=/usr -DRESTINIO_TEST=Off -DRESTINIO_SAMPLE=Off -DRESTINIO_BENCHMARK=Off -DRESTINIO_WITH_SOBJECTIZER=Off -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system .
make && make installTo run openDHT on a different computer from the build computer, the following runtime dependencies are required:
sudo apt install libargon2-1 libjsoncpp26# Install dependencies
sudo apt install pkg-config libncurses5-dev libreadline-dev nettle-dev libgnutls28-dev libargon2-0-dev libmsgpack-dev libssl-dev libfmt-dev libjsoncpp-dev libhttp-parser-dev libasio-dev
# Install Python binding dependencies
sudo apt-get install cython3 python3-dev python3-setuptools python3-buildOptionally, install RESTinio to enable the OpenDHT proxy client and server:
mkdir /usr/include/nonstd
wget https://raw.githubusercontent.com/martinmoene/expected-lite/master/include/nonstd/expected.hpp -O /usr/include/nonstd/expected.hpp
wget https://github.com/Stiffstream/restinio/releases/download/v.0.7.9/restinio-0.7.9.tar.bz2
tar -xjf restinio-0.7.9.tar.bz2
cd restinio-0.7.9/dev
cmake -DCMAKE_INSTALL_PREFIX=/usr -DRESTINIO_TEST=Off -DRESTINIO_SAMPLE=Off -DRESTINIO_BENCHMARK=Off -DRESTINIO_WITH_SOBJECTIZER=Off -DRESTINIO_DEP_STANDALONE_ASIO=system -DRESTINIO_DEP_LLHTTP=system -DRESTINIO_DEP_FMT=system -DRESTINIO_DEP_EXPECTED_LITE=system .
make && make install# Install GnuTLS, Readline and msgpack-c
sudo dnf install readline-devel gnutls-devel msgpack-devel asio-devel libargon2-devel fmt-devel
# Install python binding dependencies
sudo dnf install python3-Cython python3-devel redhat-rpm-configbrew install gnutls msgpack-cxx argon2 asio readline jsoncpp fmt llhttpUsing CMake:
# Clone the repository
git clone https://github.com/savoirfairelinux/opendht.git
# Build and install
cd opendht
mkdir build && cd build
cmake ..
make -j$(nproc)
sudo make installMinimal build (libraries only):
cmake -DOPENDHT_TOOLS=OFF ..Full-featured build with proxy support, Python, and C bindings:
cmake -DOPENDHT_PYTHON=ON \
-DOPENDHT_C=ON \
-DOPENDHT_PROXY_SERVER=ON \
-DOPENDHT_PROXY_SERVER_IDENTITY=ON \
-DOPENDHT_PROXY_CLIENT=ON \
-DOPENDHT_PUSH_NOTIFICATIONS=ON ..| Option | Default | Purpose |
|---|---|---|
OPENDHT_TOOLS |
ON | CLI tools (dhtnode, dhtchat, …) |
OPENDHT_C |
OFF | C language bindings |
OPENDHT_PYTHON |
OFF | Python 3 Cython bindings |
OPENDHT_PROXY_SERVER |
OFF | REST API proxy server (requires RESTinio + llhttp) |
OPENDHT_PROXY_CLIENT |
OFF | REST API proxy client |
OPENDHT_PEER_DISCOVERY |
OFF | Multicast local peer discovery |
OPENDHT_PUSH_NOTIFICATIONS |
OFF | Push notification support |
OPENDHT_SANITIZE |
OFF | AddressSanitizer + stack protector |
Building on Windows with MSVC is supported with VCPKG and CMake.
- Install VCPKG and required dependencies:
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg; .\bootstrap-vcpkg.bat- Use CMake preset for vcpkg:
cd opendht
cmake --preset=vcpkg_manifest .
cmake --build .