Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

240.1. libktorrent-26.08.2

BitTorrent protocol library behind KTorrent: DHT, uTP, encryption, magnet links and UPnP

26.08.2-1 · GPL-2.0-or-later AND BSD-3-Clause AND MIT AND CC0-1.0 · 2.2 SBU · 3.1 MiB, 195 files · 43_toolkits, 330 of 344 · ports/core/transfer/libktorrent

Homepage: https://invent.kde.org/network/libktorrent

LibKTorrent is the BitTorrent engine of ktorrent: torrent and magnet-link parsing, the peer wire protocol with message stream encryption, the DHT, µTP, trackers over HTTP and UDP, web seeds, UPnP port mapping, piece selection and disk storage with preallocation. KTorrent’s interface and plugins sit on top of it, and kget’s BitTorrent transfer plugin is the one other program in the tree that links it.

Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, karchive, kcrash, ki18n, kio, solid, boost, gmp, openssl.

Required by (2): kget, ktorrent.

Sources: libktorrent-26.08.2.tar.xz (592.7 KiB). Every step kpkg takes applies to this port.

Install: script/chroot/exec.sh bash -c 'source script/phases/43_toolkits/phase.env && kpkg install libktorrent'

build.sh:

cmake -S . -B build -G Ninja \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D KDE_INSTALL_LIBDIR=lib \
	-D CMAKE_BUILD_TYPE=Release \
	-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
	-D BUILD_TESTING=OFF \
	-D KF_SKIP_PO_PROCESSING=ON \
	-D USE_CRYPTO_BACKEND=OpenSSL \
	-D WITH_XFS=OFF \
	-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build

Libraries: libKTorrent6.so.

Directories: /usr/include/libktorrent, /usr/lib/cmake/KTorrent6, /usr/share/licenses/libktorrent.

musl has no separate 64-bit file functions (fopen64, fseeko64, mmap64 and the rest), so the configure’s checks for them fail. That is expected: the code falls back to the plain calls, and off_t is 64 bits wide on musl, so files over 2 GiB work.

boost is a header-only requirement (the configure asks for Boost’s own CMake package, and µTP uses its circular_buffer), and gmp does the Diffie-Hellman arithmetic of the encrypted handshake. The library opens listening sockets for peers, the DHT and µTP only when an application starts a torrent session.

The ktcli example is built with the library and not installed.