This page describes the process of building qBittorrent on Windows targeting x86_64 (aka x64 aka AMD64 aka 64-bit) architecture. Building for x86_64 arch is only supported by Visual Studio Professional or better, Express edition won't do.
Note: It is possible to use 64-bit compiler collection included in WinSDK 7.1. But if you already have ANY edition of Visual Studio 2010 installed with SP1 applied you won't be able to install it. Thus, using WinSDK is out of this article's scope.
Another note: Even though this article tries to be as full as possible, it is not recommended for users without basic knowledge in programming and windows shell scripting.
Final note: Resulting binary will not support Windows XP 64-bit Edition and Windows Server 2003 64-bit Edition unless you follow special notes describing how to make it compatible with those systems.
Table of Contents
- Software Requirements
- Source Requirements
- Preparing Directory Structure
- Build Zlib
- Build OpenSSL
- Build Boost
- Build libtorrent
- Build Qt
- Build qBittorrent
- Using resulting binaries on different computers
Software Requirements
- At least Windows Vista 64-bit
- At least Visual Studio 2010 Professional Edition.
- Perl. ActiveState Perl x86 is known to work.
- Latest version of NASM assembler.
Source Requirements
-
Latest version of Zlib.
- 1.2.7 is used in this article.
-
Latest version of OpenSSL. Be sure to download the one without fips in the name.
- 1.0.1c is used in this article.
-
Latest version of Qt. Look for
The source code is available as a zip
on download page. This is what you need, not the prebuilt binaries.Note: Qt5 is currently not supported by qBittorrent.
- 4.8.4 is used in this article.
- If you can't download from the official site with official links use a direct link like that:
https://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-VERSION.tar.gz
whereVERSION
is, for example,4.8.4
- An example direct link: https://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.4.tar.gz
-
Latest version of Boost.
- 1.52 is used in this article.
-
Latest version of libtorrent-rasterbar.
- 0.16.6 is used in this article.
-
Latest version of qBittorrent or you can Download Master Branch from GitHub.
- Git master is used in this article.
-
Maxmind GeoIP Database.
Preparing Directory Structure
-
First of all you will need a working directory structure for source code and compiled binaries. Create something like that:
C:\work \sources \install
-
In this article I'm using a drive as a working directory, so I have something like that:
T: \sources \install
This directory structure will be used as an example.
Build Zlib
-
Unpack Zlib into
\sources\zlib\
. -
Open
Visual Studio x64 Win64 Command Prompt (2010)
usually found inStart->All Programs->Microsoft Visual Studio 2010->Visual Studio Tools
-
Navigate to Zlib source folder.
-
Edit
.\win32\Makefile.msc
and do the following changes:AS=ml
to
AS=ml64
ASFLAGS = -coff -Zi $(LOC)
to
ASFLAGS = $(LOC)
CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
to
CFLAGS = -nologo -MD -O2 -w -favor:blend -GL -GR- -Y- -MP -EHs-c- $(LOC)
LDFLAGS = -nologo -debug -incremental:no -opt:ref
to
LDFLAGS = -nologo -incremental:no -opt:ref -opt:icf=5 -ltcg
ARFLAGS = -nologo
to
ARFLAGS = -nologo -ltcg
-
Build Zlib:
nmake -f .\win32\Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -DNDEBUG -I." OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" nmake -f .\win32\Makefile.msc test
Last command will run a short test to make sure that Zlib is working.
-
Install Zlib into
\install\zlib
folder:Technical note: because Makefile does not provide an install target, we need to do it ourselves.
IF EXIST T:\install\zlib RD /S /Q T:\install\zlib MD T:\install\zlib FOR %X IN (bin lib include) DO ( MD T:\install\zlib\%X ) XCOPY /Y /Q /I .\*.dll T:\install\zlib\bin\ XCOPY /Y /Q /I .\*.lib T:\install\zlib\lib\ XCOPY /Y /Q /I .\zconf.h T:\install\zlib\include\ XCOPY /Y /Q /I .\zlib.h T:\install\zlib\include\
Build OpenSSL
-
Unpack OpenSSL into
\sources\openssl\
. -
Install Perl if you haven't. In this article Perl is installed in
T:\Perl
.It is recommended to install both perl and NASM to directory structure without spaces.
-
Open
Visual Studio x64 Win64 Command Prompt (2010)
. -
Navigate to OpenSSL source folder.
-
If you still haven't installed NASM, now is the best time. In this article NASM is installed in
T:\NASM
. -
Adjust
PATH
variable:SET "PATH=T:\NASM;%PATH%"
-
Configure OpenSSL:
perl Configure VC-WIN64A threads shared zlib -IT:\install\zlib\include -LT:\install\zlib\lib --prefix=T:\install\openssl .\ms\do_win64a.bat
-
Edit
.\ms\ntdll.mak
and do the following changes:- Find line starting with
CFLAG=
and on that line:- Replace
/Ox
with/O2 /favor:blend /GL /Y-
- Replace
- Find line starting with
LFLAGS=
- Replace
/debug
with/OPT:ICF=5 /LTCG
- Replace
- Find line starting with
MLFLAGS=
- Replace
/debug
with/OPT:ICF=5 /LTCG
- Replace
- Find line starting with
ASM=
- Remove
-g
from that line
- Remove
- Find line
$(SHLIB_EX_OBJ) $(CRYPTOOBJ) zlib1.lib $(EX_LIBS)
- Replace
zlib1.lib
withzlib.lib
in line
- Replace
- Find line starting with
-
Build OpenSSL:
nmake -f .\ms\ntdll.mak
-
Optional. Test OpenSSL:
nmake -f .\ms\ntdll.mak test
Somewhere near the end of test you should see:
Available compression methods: 1: zlib compression
And in the very end you should see
passed all tests
. -
Install OpenSSL:
nmake -f .\ms\ntdll.mak install
Build Boost
-
Unpack Boost into
\sources\boost\
. -
Open
Visual Studio x64 Win64 Command Prompt (2010)
. -
Navigate to Boost source folder.
-
Build and install bjam (aka Boost-Build):
CD .\tools\build\v2 .\bootstrap.bat vc10 .\b2.exe --toolset=msvc architecture=x86 address-model=64 --prefix=T:\install\bjam link=shared runtime-link=shared variant=release debug-symbols=off warnings=off warnings-as-errors=off inlining=full optimization=speed "cflags=/O2 /GL /Gy /favor:blend" "linkflags=/NOLOGO /OPT:REF /OPT:ICF=5 /LTCG" install CD ..\..\..\
-
Build and install Boost:
SET "PATH=T:\install\bjam\bin;%PATH%" bjam -j2 -q --with-system --toolset=msvc --layout=system --prefix=T:\install\boost link=shared runtime-link=shared variant=release debug-symbols=off threading=multi address-model=64 host-os=windows target-os=windows embed-manifest=on architecture=x86 warnings=off warnings-as-errors=off inlining=full optimization=speed "cflags=/O2 /GL /favor:blend" "linkflags=/NOLOGO /OPT:REF /OPT:ICF=5 /LTCG" install XCOPY /Y /Q /I .\*.jam T:\install\boost\ COPY /Y Jamroot T:\install\boost\
Build libtorrent
-
Unpack libtorrent into
\sources\libtorrent\
. -
Open
Visual Studio x64 Win64 Command Prompt (2010)
. -
Navigate to libtorrent source folder.
-
Edit
include/libtorrent/escape_string.hpp
to fix symbol export with dynamic linking:- Replace
TORRENT_EXTRA_EXPORT std::string base32decode(std::string const& s);
with
TORRENT_EXPORT std::string base32decode(std::string const& s);
- Replace
-
Build and install libtorrent:
SET "PATH=T:\install\bjam\bin;%PATH%" bjam -j2 -q --toolset=msvc --prefix=T:\install\libtorrent boost=system boost-link=shared link=shared runtime-link=shared variant=release debug-symbols=off resolve-countries=on full-stats=on export-extra=off ipv6=on dht-support=on character-set=unicode geoip=static encryption=openssl windows-version=vista threading=multi address-model=64 host-os=windows target-os=windows embed-manifest=on architecture=x86 warnings=off warnings-as-errors=off inlining=full optimization=speed "cflags=/O2 /GL /favor:blend" "linkflags=/NOLOGO /OPT:REF /OPT:ICF=5 /LTCG" "include=T:\install\OpenSSL\include" "include=T:\install\Boost\include" "library-path=T:\install\OpenSSL\lib" "library-path=T:\install\Boost\lib" "define=BOOST_ALL_NO_LIB" install
- If you want to build For XP 64-bit or WinServer 2003 64-bit you must build with
windows-version=xp
instead ofwindows-version=vista
- If you want to build For XP 64-bit or WinServer 2003 64-bit you must build with
Build Qt
-
Unpack Qt into
\sources\Qt\
. -
Open
Visual Studio x64 Win64 Command Prompt (2010)
. -
Navigate to Qt source folder.
-
Build Qt:
.\configure.exe -release -shared -opensource -confirm-license -platform win32-msvc2010 -arch windows -ltcg -no-fast -exceptions -no-accessibility -stl -no-xmlpatterns -no-sql-mysql -no-sql-psql -no-sql-oci -no-sql-odbc -no-sql-tds -no-sql-db2 -qt-sql-sqlite -no-sql-sqlite2 -no-sql-ibase -no-qt3support -no-opengl -no-openvg -graphicssystem raster -qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -no-dsp -no-vcproj -no-incredibuild-xge -plugin-manifests -process -mp -rtti -no-3dnow -mmx -sse -sse2 -openssl -no-dbus -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-script -no-scripttools -no-declarative -no-declarative-debug -no-style-s60 -no-style-windowsmobile -no-style-windowsce -no-style-cde -no-style-motif -qt-style-cleanlooks -qt-style-plastique -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -no-native-gestures -no-directwrite -qmake -nomake examples -nomake demos -nomake docs -I T:\install\OpenSSL\include -L T:\install\OpenSSL\lib -prefix T:\install\Qt nmake sub-src nmake sub-translations-make_default-ordered
-
Install Qt:
nmake install
Build qBittorrent
-
Unpack qbittorrent into
\sources\qbt\
. -
Open
Visual Studio x64 Win64 Command Prompt (2010)
. -
Navigate to qbittorrent source folder.
-
Prepare qBt sources:
- Unpack Maxmind GeoIP.dat file into
.\src\geoip\
- Edit
.\src\src.pro
:- Find and remove line
DEFINES += BOOST_FILESYSTEM_VERSION=2
- Find and remove line
- Edit
winconf-msvc.pri
:-
Find
CONFIG(debug, debug|release) { LIBS += libtorrentd.lib \ libboost_system-vc90-mt-sgd-1_51.lib } else { LIBS += libtorrent.lib \ libboost_system-vc90-mt-s-1_51.lib }
and replace with
CONFIG(debug, debug|release) { LIBS += torrent.lib \ boost_system.lib } else { LIBS += torrent.lib \ boost_system.lib }
-
- Edit
winconf.pri
and adjust paths accordingly (remember thatT:\install\
is used as an example):-
Find
INCLUDEPATH += $$quote(C:/qBittorrent/boost_1_51_0)
and replace with
INCLUDEPATH += $$quote(T:/install/Boost/include)
-
Find
INCLUDEPATH += $$quote(C:/qBittorrent/RC_0_16/include)
and replace withINCLUDEPATH += $$quote(T:/install/libtorrent/include)
-
Find
INCLUDEPATH += $$quote(C:/qBittorrent/Zlib/include)
and replace withINCLUDEPATH += $$quote(T:/install/Zlib/include)
and insertINCLUDEPATH += $$quote(T:/install/OpenSSL/include)
on next line -
Find
LIBS += $$quote(-LC:/qBittorrent/boost_1_51_0/stage/lib)
and replace withLIBS += $$quote(-LT:/install/Boost/lib)
-
Find
LIBS += $$quote(-LC:/qBittorrent/RC_0_16/bin/<path-according-to-the-build-options-chosen>)
and replace withLIBS += $$quote(-LT:/install/libtorrent/lib)
-
Find
LIBS += $$quote(-LC:/qBittorrent/Zlib/lib)
and replace withLIBS += $$quote(-LT:/install/Zlib/lib)
and insertLIBS += $$quote(-LT:/install/OpenSSL/lib)
on next line -
Find and remove the following lines:
DEFINES += BOOST_ASIO_SEPARATE_COMPILATION
DEFINES += BOOST_SYSTEM_STATIC_LINK=1
-
Find
DEFINES += BOOST_ALL_NO_LIB
and insertDEFINES += BOOST_ASIO_ENABLE_CANCELIO
on next line -
Find
DEFINES += BOOST_EXCEPTION_DISABLE
and insertDEFINES += BOOST_ASIO_DYN_LINK DEFINES += BOOST_ALL_DYN_LINK
on previous line
-
Find
DEFINES += TORRENT_USE_OPENSSL
and insertDEFINES += TORRENT_LINKING_SHARED
on next line -
Find
DEFINES += _WIN32_WINNT=0x0500
and replace withDEFINES += _WIN32_WINNT=0x0600
- If you want to build For XP 64-bit or WinServer 2003 64-bit replace
DEFINES += _WIN32_WINNT=0x0500
withDEFINES += _WIN32_WINNT=0x0501
- If you want to build For XP 64-bit or WinServer 2003 64-bit replace
-
- Unpack Maxmind GeoIP.dat file into
-
Build qBt:
SET "PATH=T:\install\Qt\bin;%PATH%"
-
Update translations
CD .\src lupdate -no-obsolete ./src.pro CD ..\
-
Build
MD build CD build qmake -config release -r ../qbittorrent.pro "CONFIG += warn_off msvc_mp rtti ltcg mmx sse sse2" "CONFIG -= 3dnow" nmake
-
-
Install qBt:
XCOPY /Y /Q /I .\src\release\qbittorrent.exe T:\install\qBittorrent\ FOR %X IN (QtCore4.dll QtGui4.dll QtNetwork4.dll QtXml4.dll) DO ( COPY /Y T:\install\Qt\bin\%X T:\install\qBittorrent\ ) XCOPY /Y /Q /I T:\install\Qt\plugins\imageformats\qico4.dll T:\install\qBittorrent\plugins\imageformats\ FOR /F "usebackq" %X IN (`DIR /B "T:\sources\qbt\src\qt-translations\"`) DO ( IF EXIST "T:\install\Qt\translations\%X" ( COPY /Y "T:\install\Qt\translations\%X" "T:\sources\qbt\src\qt-translations\" ) ) XCOPY /Y /Q /I T:\sources\qbt\src\qt-translations\qt_* T:\install\qBittorrent\translations\ XCOPY /Y /Q /I T:\install\OpenSSL\bin\*.dll T:\install\qBittorrent\ XCOPY /Y /Q /I T:\install\libtorrent\lib\torrent.dll T:\install\qBittorrent\ XCOPY /Y /Q /I T:\install\Boost\lib\*.dll T:\install\qBittorrent\ echo [Paths] > T:\install\qBittorrent\qt.conf echo Translations = ./translations >> T:\install\qBittorrent\qt.conf echo Plugins = ./plugins >> T:\install\qBittorrent\qt.conf
Using resulting binaries on different computers
If you want to use the resulting binaries on other Windows computers (or redistribute them) you will need Microsoft Visual C++ 2010 SP1 Redistributable Package (x64). Users must have it installed in order to use any x86_64 software compiled with Visual Studio 2010. If you are using qBt on computer, which was used for building it, you don't need VC++ 2010 x64 Redistributable Package, because you already have it installed (it came with Visual Studio 2010).
Alternatively you can copy redistributable dlls into program folder like this:
XCOPY /Y /Q /I "%VCINSTALLDIR%\redist\x64\Microsoft.VC100.CRT\*.dll" T:\install\qBittorrent\
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 ≥ v4.1 |
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