-
Notifications
You must be signed in to change notification settings - Fork 123
Windows MSVC Static Build Guide
- Git for windows
- Perl (I recommend ActivePerl)
- Python
- Qt Sources (get through the maintenance tool here)
- MSVC++ (get through Visual Studio Installer)
- Search for "Edit the system environment variables"
- Click "Environment Variables..." at the bottom right
- In the bottom "System variables" pane, select "Path" and click "Edit..."
- Click "New" and add your QtCreator bin folder (Default
C:\Qt\Tools\QtCreator\bin
)
For this guide, you should use one of the following
64-bit: x64 Native Tools Command Prompt for VS 20XX
32-bit: x86 Native Tools Command Prompt for VS 20XX
To start, get the latest stable OpenSSL source through git
git clone https://github.com/openssl/openssl.git
And switch to the latest stable branch (as of the time of writing, it is OpenSSL_1_1_0-stable
)
Replace <LATEST_STABLE_BRANCH>
with the latest stable branch
git checkout <LATEST_STABLE_BRANCH>
Configure OpenSSL (make sure you have perl installed and in path)
Replace <OPENSSL_DIR>
with your desired installed openssl location
64-bit: perl Configure VC-WIN64A no-shared threads --prefix=<OPENSSL_DIR> --openssldir=<OPENSSL_DIR>
32-bit: perl Configure VC-WIN32 no-shared threads --prefix=<OPENSSL_DIR> --openssldir=<OPENSSL_DIR>
If you built before already, clean old files before building again
nmake clean
Build OpenSSL using nmake (jom doesn't work as of the time of writing)
nmake
Install OpenSSL
nmake install
You should already have Qt Sources downloaded per the prerequisites, so navigate to your Qt source folder (default C:\Qt\<YOUR_QT_VERSION>\Src
)
There are a few things to change here, so pay attention.
-
-prefix
is the folder for the build, if you want to use my structure, replace <YOUR_QT_VERSION> with your version and with "x64" or "x86" - Replace
<OPENSSL_DIR>
with the directory of the openssl you built previously - If using
OpenSSL < 1.1.0
, change-llibssl -llibcrypto
to-llibeay32 -lssleay32
.
configure -prefix C:\Qt\<YOUR_QT_VERSION>\Static_<ARCH> -platform win32-msvc -release -opensource -confirm-license -static -ltcg -nomake examples -nomake tools -openssl-linked OPENSSL_LIBS="-llibssl -llibcrypto" -I <OPENSSL_DIR>\include -L <OPENSL_DIR>\lib
If you built before already, clean old files before building again
jom clean
Build Qt statically using jom (replace # with processor's thread count) (this will take a very long time)
jom -j #
Install static Qt to your desired folder
jom install