This page describes how to compile qBittorrent for both x86 and x64 platforms using Microsoft Visual C++ 2013 under Windows.
Table of Contents
- Requirements
- Preparation
- Compiling zlib
- Compiling OpenSSL
- Compiling Boost
- Compiling libtorrent
- Compiling Qt4
- Configuring Qt Creator
- Compiling qBittorrent
Requirements
- The Microsoft Visual C++ 2013 compiler.
- A Perl language interpreter. Strawberry Perl or ActivePerl can be used. Download Strawberry Perl 5.20.1.1 here.
- Latest release of the NASM assembler. Download version 2.11.05 here.
- Latest release of zlib. Download version 1.2.8 here.
- Latest release of OpenSSL. Download version 1.0.1i here.
- Latest release of the Boost libraries. Download version 1.56.0 here.
- Latest release of libtorrent-rasterbar. Download version 0.16.17 here.
- Latest release of the Qt4 source. Download version 4.8.6 here.
- Latest release of Qt Creator. Download version 3.2.1 here.
- Latest release of qBittorrent. Download version 3.1.10 here.
Let's assume that the working directory(ies) for our compilation will be:
- For x86:
C:\qBittorrent - For x64:
C:\qBittorrent64
Preparation
- Install Perl.
- Install Qt Creator.
- Extract NASM inside our working dir, eg.:
- For x86:
C:\qBittorrent\nasm
- For x86:
Compiling zlib
-
Extract the zlib source inside our working dir(s).
-
Rename the resulting dir(s) from
zlib-x.x.xto justzlib. -
Open the MSVC2013 command shell:
- For x86:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt - For x64:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x64 Native Tools Command Prompt
- For x86:
-
Navigate to the zlib source folder:
- For x86:
pushd C:\qBittorrent\zlib - For x64:
pushd C:\qBittorrent64\zlib
- For x86:
-
Edit the
win32\Makefile.mscfile. -
Find the line starting with
CFLAGS- Replace
-MDwith-GL -MT -Zc:wchar_t-
- Replace
-
Find the line starting with
LDFLAGS- Replace
-debugwith-opt:icf -dynamicbase -nxcompat -ltcg /nodefaultlib:msvcrt
- Replace
-
Issue the following commands:
-
For x86:
nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF -DNDEBUG -I." OBJA="inffas32.obj match686.obj" -
For x64:
nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -DNDEBUG -I." OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"
-
-
Copy zlib.h, zconf.h, zlib.lib, zlib.pdb to our install dir.
-
For x86:
xcopy zlib.h C:\qBittorrent\install\include\ xcopy zconf.h C:\qBittorrent\install\include\ xcopy zlib.lib C:\qBittorrent\install\lib\ xcopy zlib.pdb C:\qBittorrent\install\lib\ -
For x64:
xcopy zlib.h C:\qBittorrent64\install\include\ xcopy zconf.h C:\qBittorrent64\install\include\ xcopy zlib.lib C:\qBittorrent64\install\lib\ xcopy zlib.pdb C:\qBittorrent64\install\lib\
-
Compiling OpenSSL
-
Make sure you have installed Perl and NASM (for x86).
-
Extract the OpenSSL source inside our working dir(s).
-
Rename the resulting dir(s) from
openssl-x.x.xto justopenssl. -
Open the MSVC2013 command shell:
- For x86:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt - For x64:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x64 Native Tools Command Prompt
- For x86:
-
Navigate to the OpenSSL source folder:
- For x86:
pushd C:\qBittorrent\openssl - For x64:
pushd C:\qBittorrent64\openssl
- For x86:
-
Now we will build a static version of OpenSSL. Issue the following commands:
-
For x86:
set "PATH=%PATH%;C:\qBittorrent\nasm" perl Configure VC-WIN32 no-shared zlib no-zlib-dynamic threads --prefix=C:\qBittorrent\install -IC:\qBittorrent\install\include -LC:\qBittorrent\install\lib ms\do_nasm -
For x64:
perl Configure VC-WIN64A no-shared zlib no-zlib-dynamic threads --prefix=C:\qBittorrent64\install -IC:\qBittorrent64\install\include -LC:\qBittorrent64\install\lib ms\do_win64a.bat
-
-
Edit the
ms\nt.makfile:-
Find the line that starts with:
EX_LIBS- Replace
zlib1.libwithzlib.lib
- Replace
-
Find the line that starts with:
CFLAG- Append:
/Zc:wchar_t- /GL /Zi
- Append:
-
Find the line that starts with:
LFLAGS- Replace
/debugwith/incremental:no /opt:icf /dynamicbase /nxcompat /ltcg /nodefaultlib:msvcrt
- Replace
-
Then issue the following:
nmake -f ms\nt.mak nmake -f ms\nt.mak install
-
Compiling Boost
-
Extract the Boost sources in the working dir(s).
-
Rename the resulting dir(s) from
boost_x_x_xto justboost. -
Open the MSVC2013 command shell:
- For x86:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt - For x64:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x64 Native Tools Command Prompt
- For x86:
-
Navigate to the Boost source folder:
- For x86:
pushd C:\qBittorrent\boost - For x64:
pushd C:\qBittorrent64\boost
- For x86:
-
Now you will need to bootstrap Boost so it will build
b2.exe. Issue the following command:bootstrap.bat vc12 -
Compile a static version of Boost. Issue the following command (if you want to set how many threads b2 uses when compiling, add
-j Nto the end of the command, whereNis the number of threads; thetoolsetparameter is needed for the correct choice ofmsvc-12.0if other versions are installed):-
For x86:
b2 -q --with-system --toolset=msvc-12.0 variant=release link=static runtime-link=static debug-symbols=off warnings=off warnings-as-errors=off -
For x64:
b2 -q --with-system --toolset=msvc-12.0 variant=release link=static runtime-link=static debug-symbols=off warnings=off warnings-as-errors=off architecture=x86 address-model=64
-
Compiling libtorrent
- Extract the libtorrent sources in the working dir(s).
- Rename the resulting dir(s) from
libtorrent-rasterbar-x.x.xto justlibtorrent. - Open the MSVC2013 command shell:
- For x86:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt - For x64:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x64 Native Tools Command Prompt
- For x86:
- Navigate to the libtorrent source folder:
- For x86:
pushd C:\qBittorrent\libtorrent - For x64:
pushd C:\qBittorrent64\libtorrent
- For x86:
- Compile a static version of libtorrent. Issue the following command (if you want to set how many threads b2 uses when compiling, add
-j Nto the end of the command, whereNis the number of threads):-
For x86:
..\boost\b2 -q --prefix="stage" --without-python --toolset=msvc-12.0 variant=release link=static runtime-link=static encryption=openssl logging=none geoip=static dht-support=on boost=source character-set=unicode boost-link=static -sBOOST_ROOT="C:\qBittorrent\boost" include="C:\qBittorrent\install\include" library-path="C:\qBittorrent\install\lib" install -
For x64:
..\boost\b2 -q --prefix="stage" --without-python --toolset=msvc-12.0 variant=release link=static runtime-link=static encryption=openssl logging=none geoip=static dht-support=on boost=source character-set=unicode boost-link=static -sBOOST_ROOT="C:\qBittorrent64\boost" include="C:\qBittorrent64\install\include" library-path="C:\qBittorrent64\install\lib" architecture=x86 address-model=64 install -
Note: When you use libtorrent-rasterbar-1.0.4: change
dht-support=ontodht=onsee libtorrent manual
-
Compiling Qt4
-
Extract the Qt4 sources in the working dir(s).
-
Rename the resulting dir(s) from
qt-everywhere-opensource-src-x.x.xto justqt4. -
Open the MSVC2013 command shell:
- For x86:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x86 Native Tools Command Prompt - For x64:
Start->Programs->Visual Studio 2013->Visual Studio Tools->VS2013 x64 Native Tools Command Prompt
- For x86:
-
Navigate to the Qt4 source folder:
- For x86:
pushd C:\qBittorrent\qt4 - For x64:
pushd C:\qBittorrent64\qt4
- For x86:
-
Now we will build a static version of Qt4 with making as small as possible.
-
Open
mkspecs\win32-msvc2013\qmake.confand replace the- Find the line that starts with:
QMAKE_CFLAGS_RELEASE- Replace
-MDwith-GL -MT
- Replace
- Find the line that starts with:
QMAKE_LFLAGS- Replace
/NXCOMPATwith/NXCOMPAT /LTCG
- Replace
- Find the line that starts with:
QMAKE_LFLAGS_RELEASE- Replace
/INCREMENTAL:NOwith/INCREMENTAL:NO /NODEFAULTLIB:MSVCRT
- Replace
- Find the line that starts with:
-
Open
src\3rdparty\zlib_dependency.priandsrc\tools\bootstrap\bootstrap.pri- Replace
zdll.libwithzlib.lib
- Replace
-
Issue the following commands:
-
For x86:
configure.exe -release -opensource -confirm-license -static -ltcg -fast -system-zlib -no-qt3support -no-opengl -no-openvg -no-dsp -no-vcproj -no-dbus -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-script -no-scripttools -no-declarative -no-declarative-debug -mp -arch windows -qt-style-windowsxp -nomake examples -nomake demos -platform win32-msvc2013 -openssl-linked -largefile -I "C:\qBittorrent\install\include" -L "C:\qBittorrent\install\lib" bin\qmake.exe projects.pro QT_BUILD_PARTS="libs translations" nmake -
For x64:
configure.exe -release -opensource -confirm-license -static -ltcg -fast -system-zlib -no-qt3support -no-opengl -no-openvg -no-dsp -no-vcproj -no-dbus -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-script -no-scripttools -no-declarative -no-declarative-debug -mp -arch windows -qt-style-windowsxp -nomake examples -nomake demos -platform win32-msvc2013 -openssl-linked -largefile -I "C:\qBittorrent64\install\include" -L "C:\qBittorrent64\install\lib" bin\qmake.exe projects.pro QT_BUILD_PARTS="libs translations" nmake
-
-
You can close the command prompt now.
Configuring Qt Creator
- Launch Qt Creator and select
Tools->Options... - Select the
Build & Runitem from the left and select theQt Versionstab.- For x86:
- Click the
Add...button and selectqmake.exe. It should be in:C:\qBittorrent\qt4\bin\qmake.exe - Name it something meaningful like
Qt4 - MSVC2013 (x86)
- Click the
- For x64:
- Click the
Add...button and selectqmake.exe. It should be in:C:\qBittorrent64\qt4\bin\qmake.exe - Name it something meaningful like
Qt4 - MSVC2013 (x64)
- Click the
- For x86:
- Still in the
Build & Runitem, select theKitstab.- For x86:
- Click the
Add...button and name itx86 - In
CompilerselectMicrosoft Visual C++ Compiler 12.0 (x86) - In
Qt versionselectQt4 - MSVC2013 (x86)
- Click the
- For x64:
- Click the
Add...button and name itx64 - In
CompilerselectMicrosoft Visual C++ Compiler 12.0 (amd64) - In
Qt versionselectQt4 - MSVC2013 (x64)
- Click the
- For x86:
Compiling qBittorrent
-
Extract the qBittorrent sources in the working dir(s).
-
Go to Maxmind and download the GeoLite Country database in binary format. Here is the link. Extract the
GeoIP.datfile to:src\gui\geoip -
Open the
winconf.prifile, edit and adjust the paths:- For both:
- Replace
_WIN32_WINNT=0x0500with_WIN32_WINNT=0x0501
- Replace
- For x86:
- Replace
C:/qBittorrent/boost_1_51_0withC:/qBittorrent/boost - Replace
C:/qBittorrent/RC_0_16/includewithC:/qBittorrent/libtorrent/include - Replace
C:/qBittorrent/Zlib/includewithC:/qBittorrent/install/include - Replace
C:/qBittorrent/boost_1_51_0/stage/libwithC:/qBittorrent/boost/stage/lib - Replace
C:/qBittorrent/RC_0_16/bin/<path-according-to-the-build-options-chosen>withC:/qBittorrent/libtorrent/stage/lib - Replace
C:/qBittorrent/Zlib/libwithC:/qBittorrent/install/lib
- Replace
- For x64:
- Replace
C:/qBittorrent/boost_1_51_0withC:/qBittorrent64/boost - Replace
C:/qBittorrent/RC_0_16/includewithC:/qBittorrent64/libtorrent/include - Replace
C:/qBittorrent/Zlib/includewithC:/qBittorrent64/install/include - Replace
C:/qBittorrent/boost_1_51_0/stage/libwithC:/qBittorrent64/boost/stage/lib - Replace
C:/qBittorrent/RC_0_16/bin/<path-according-to-the-build-options-chosen>withC:/qBittorrent64/libtorrent/stage/lib - Replace
C:/qBittorrent/Zlib/libwithC:/qBittorrent64/install/lib
- Replace
- For both:
-
Open the
winconf-msvc.prifile and adjust the filename of the lib of Boost:- Check
C:\qBittorrent\boost\stage\liborC:\qBittorrent64\boost\stage\libfor the.libname, it should be named in this format:libboost_system-vcx-mt-s-x_x.lib, eg:libboost_system-vc120-mt-s-1_56.lib - Replace
libboost_system-vc90-mt-s-1_51.libwith the.libname.
- Check
-
Launch Qt Creator and open the
qbittorrent.profile.- For x86: check the
x86checkbox and clickConfigure Project - For x64: check the
x64checkbox and clickConfigure Project
- For x86: check the
-
Change the configuration from
DebugtoReleasein the left side of the window (where the computer icon is). -
Select
Build->Build All -
After the compilation ends you should have
qbittorrent.exein:- For x86:
C:\qBittorrent\build-qbittorrent-x86-Release\src\release - For x64:
C:\qBittorrent64\build-qbittorrent-x64-Release\src\release
- For x86:
General
- Installing qBittorrent
- Frequently Asked Questions (FAQ)
- qBittorrent options (current and deprecated)
- How to use qBittorrent as a tracker
- How to use portable mode
- Anonymous mode
- How to bind your vpn to prevent ip leaks
Troubleshooting
External programs
Search plugins
Themes
Translation
WebUI
WebUI API
| State | Version |
|---|---|
| Current | qBittorrent >= 5.0 |
| Previous | qBittorrent v4.1.0 - v4.6.x |
| Previous | qBittorrent v3.2.0 - v4.0.x |
| Obsolete | qBittorrent < v3.2.0 |
WebAPI clients
Alternate WebUI
Reverse proxy setup for WebUI access
WebUI HTTPS configuration
- Let's Encrypt Certificates + Caddy2 Reverse Proxy
- Let's Encrypt certificates + NGINX reverse proxy - Linux
- Let's Encrypt certificates - Linux
- Self-signed SSL certificates - Linux
Linux
- Running qBittorrent without X server (WebUI only)
- Running qBittorrent without X server (WebUI only, systemd service set up, Ubuntu 15.04 or newer)
- OpenVPN and qBittorrent without X server
Development
- Coding style
- Contributing
- How to write a search plugin
- Using VSCode for qBittorrent development
- Setup GDB with Qt pretty printers
- How to debug WebUI code
Compilation
*BSD, Linux
- Alpine Linux
- CentOS 8.x
- Debian / Ubuntu and derivatives (CMake)
- Debian / Ubuntu and derivatives (autotools/qmake)
- Docker
- FreeBSD (no GUI)
- Fully static binaries on Linux (glibc or musl)
- Raspberry Pi OS / DietPi
- Raspbian for LeMaker Banana Pro