Version 12 (modified by Cas, 8 years ago) (diff)

update windows build steps

This page is for those cases where libtorrent is needing to be built from source. Remember to check the libtorrent docs for any updates to build procedures.


  1. Download libtorrent source tarball and extract it:
  1. Get the dependencies for libtorrent
    sudo apt-get build-dep libtorrent-rasterbar
  1. Build (in the extracted tarball dir):
    ./configure --enable-python-binding

Note: For source code from svn, create the configure script by runnning: ./

  1. Install:
    sudo apt-get install checkinstall
    sudo checkinstall
    This will install libtorrent and bindings in the correct place. I have substituted checkinstall for make install because checkinstall creates a deb package that then can be used by dpkg to remove all the installed files easily.
  1. Verify libtorrent and it's python binding are installed correctly:
    python -c "import libtorrent as lt; print lt.version"

If you encounter an !ImportError relating to opening, you may need to run sudo ldconfig or ensure Python is searching the correct path to the library.


  1. Install Visual Studio or just the compiler:
  1. Download and install these packages:
  1. Download source tarballs and extract to path without space e.g. C:\ drive:
  1. Boost Build Steps:

Open a Visual Studio 2008 Command Prompt
If using VC++ Compiler for Python, open Windows Command Prompt and execute vcvarsall.bat, e.g.:

C:\Users\User\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat

From Command Prompt, execute the following commands:


Building Boost can take a long time and uses 2-3 gigabytes of disk space.

  1. Create a Boost user-config.jam file in BOOST_ROOT (e.g. C:\boost) with the following to force msvc version:
       using msvc : 9.0 ;
  1. libtorrent Build Steps:
    1. Setup the Environmental Variables:
      set INCLUDE=C:\OpenSSL-Win32\include;%INCLUDE%
      set LIB=C:\OpenSSL-Win32\lib;%LIB%
      set BOOST_ROOT=C:\boost
      set PATH=%BOOST_ROOT%;%PATH%
    2. Navigate to libtorrent Python bindings folder:
      cd C:\libtorrent-rasterbar\bindings\python
    3. Build libtorrent with Python bindings:
b2 boost=source link=static geoip=static boost-link=static release optimization=space encryption=openssl

Upon a successful build the library file named libtorrent.pyd is created in the current bindings directory.

Debugging libtorrent on Windows

Note: Only need to install debug tools.

  • Build libtorrent with debug enabled by changing release to debug in or b2 line in steps above.
  • In windbg C:\Program Files\Debugging Tools for Windows (x86)\windbg.exe:
    • File|Open Executable and tick Debug child processes
  • Hit F5 or Go a few times to get the program running
  • Execute the following command after a crash:
    !analyze -v -f

  • Symbols for libtorrent will be in the following path:
    So the full symbols line should look something like this:

Debug References: