This page describes how to compile qBittorrent for both x86 and x64 platforms using Microsoft Visual C++ 2013 under Windows.
- Requirements
- Preparation
- Compiling zlib
- Compiling OpenSSL
- Compiling Boost
- Compiling libtorrent
- Compiling Qt4
- Configuring Qt Creator
- Compiling qBittorrent
- 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
- Install Perl.
- Install Qt Creator.
- Extract NASM inside our working dir, eg.:
- For x86:
C:\qBittorrent\nasm
- For x86:
-
Extract the zlib source inside our working dir(s).
-
Rename the resulting dir(s) from
zlib-x.x.x
to 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.msc
file. -
Find the line starting with
CFLAGS
- Replace
-MD
with-GL -MT -Zc:wchar_t-
- Replace
-
Find the line starting with
LDFLAGS
- Replace
-debug
with-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\
-
-
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.x
to 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.mak
file:-
Find the line that starts with:
EX_LIBS
- Replace
zlib1.lib
withzlib.lib
- Replace
-
Find the line that starts with:
CFLAG
- Append:
/Zc:wchar_t- /GL /Zi
- Append:
-
Find the line that starts with:
LFLAGS
- Replace
/debug
with/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
-
-
Extract the Boost sources in the working dir(s).
-
Rename the resulting dir(s) from
boost_x_x_x
to 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 N
to the end of the command, whereN
is the number of threads; thetoolset
parameter is needed for the correct choice ofmsvc-12.0
if 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
-
- Extract the libtorrent sources in the working dir(s).
- Rename the resulting dir(s) from
libtorrent-rasterbar-x.x.x
to 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 N
to the end of the command, whereN
is 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=on
todht=on
see libtorrent manual
-
-
Extract the Qt4 sources in the working dir(s).
-
Rename the resulting dir(s) from
qt-everywhere-opensource-src-x.x.x
to 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.conf
and replace the- Find the line that starts with:
QMAKE_CFLAGS_RELEASE
- Replace
-MD
with-GL -MT
- Replace
- Find the line that starts with:
QMAKE_LFLAGS
- Replace
/NXCOMPAT
with/NXCOMPAT /LTCG
- Replace
- Find the line that starts with:
QMAKE_LFLAGS_RELEASE
- Replace
/INCREMENTAL:NO
with/INCREMENTAL:NO /NODEFAULTLIB:MSVCRT
- Replace
- Find the line that starts with:
-
Open
src\3rdparty\zlib_dependency.pri
andsrc\tools\bootstrap\bootstrap.pri
- Replace
zdll.lib
withzlib.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.
- Launch Qt Creator and select
Tools->Options...
- Select the
Build & Run
item from the left and select theQt Versions
tab.- 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 & Run
item, select theKits
tab.- For x86:
- Click the
Add...
button and name itx86
- In
Compiler
selectMicrosoft Visual C++ Compiler 12.0 (x86)
- In
Qt version
selectQt4 - MSVC2013 (x86)
- Click the
- For x64:
- Click the
Add...
button and name itx64
- In
Compiler
selectMicrosoft Visual C++ Compiler 12.0 (amd64)
- In
Qt version
selectQt4 - MSVC2013 (x64)
- Click the
- For x86:
-
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.dat
file to:src\gui\geoip
-
Open the
winconf.pri
file, edit and adjust the paths:- For both:
- Replace
_WIN32_WINNT=0x0500
with_WIN32_WINNT=0x0501
- Replace
- For x86:
- Replace
C:/qBittorrent/boost_1_51_0
withC:/qBittorrent/boost
- Replace
C:/qBittorrent/RC_0_16/include
withC:/qBittorrent/libtorrent/include
- Replace
C:/qBittorrent/Zlib/include
withC:/qBittorrent/install/include
- Replace
C:/qBittorrent/boost_1_51_0/stage/lib
withC:/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/lib
withC:/qBittorrent/install/lib
- Replace
- For x64:
- Replace
C:/qBittorrent/boost_1_51_0
withC:/qBittorrent64/boost
- Replace
C:/qBittorrent/RC_0_16/include
withC:/qBittorrent64/libtorrent/include
- Replace
C:/qBittorrent/Zlib/include
withC:/qBittorrent64/install/include
- Replace
C:/qBittorrent/boost_1_51_0/stage/lib
withC:/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/lib
withC:/qBittorrent64/install/lib
- Replace
- For both:
-
Open the
winconf-msvc.pri
file and adjust the filename of the lib of Boost:- Check
C:\qBittorrent\boost\stage\lib
orC:\qBittorrent64\boost\stage\lib
for the.lib
name, 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.lib
with the.lib
name.
- Check
-
Launch Qt Creator and open the
qbittorrent.pro
file.- For x86: check the
x86
checkbox and clickConfigure Project
- For x64: check the
x64
checkbox and clickConfigure Project
- For x86: check the
-
Change the configuration from
Debug
toRelease
in the left side of the window (where the computer icon is). -
Select
Build->Build All
-
After the compilation ends you should have
qbittorrent.exe
in:- For x86:
C:\qBittorrent\build-qbittorrent-x86-Release\src\release
- For x64:
C:\qBittorrent64\build-qbittorrent-x64-Release\src\release
- For x86: