Skip to content

Build Libtorrent

pasenchenko edited this page Nov 3, 2021 · 10 revisions

In this article, we describe how to build libtorrent on different platforms

Windows

Boost

  1. Download the source code from http://www.boost.org/users/download/
  2. Extract in C:\Program files\Boost
  3. Run command line as administrator
  4. In the command line run
cd C:\Program files\Boost\boost_A_B_C
bootstrap.bat
b2 variant=release address-model=64 link=static,shared

Here boost_A_B_C is the downloaded version of Boost (e.g. boost_1_77_0).

  1. Add the following paths to PATH:
C:\Program Files\Boost\boost_A_B_C
C:\Program Files\Boost\boost_A_B_C\stage\lib
  1. Create the BOOST_BUILD_PATH environment variable with the value C:\Program Files\Boost\boost_A_B_C

openSSL

  1. Download openSSL (NOT Light version) and install it

Libtorrent

  1. Clone libtorrent with its submodules (use git clone --recurse-submodules link_to_git)
  2. Run command line as administrator
  3. In the command line run
cd PATH_TO_LIBTORRENT\bindings\python
python setup.py build
python setup.py install

Here PATH_TO_LIBTORRENT is the folder in which you have cloned libtorrent

Linux

Tested on Ubuntu 20.04

Boost

  1. Open Terminal (Ctrl+Alt+T)
  2. Run the following commands
sudo apt install libboost-all-dev libboost-tools-dev libboost-dev libboost-system-dev
echo "using gcc ;" >>~/user-config.jam
b2 crypto=openssl cxxstd=14 release

OpenSSL

  1. In command line run
sudo apt install libssl-dev

Libtorrent

  1. Clone libtorrent with its submodules
git clone --recurse-submodules https://github.com/arvidn/libtorrent.git
  1. Open the cloned libtorrent folder in Terminal
  2. Run
cd ./bindings/python
sudo python setup.py build
sudo python setup.py install
Clone this wiki locally