Skip to content

Windows MSVC Static Build Guide

Benjamin O edited this page Aug 24, 2018 · 18 revisions

Prerequisites

Downloads

Add jom to path

  1. Search for "Edit the system environment variables"
  2. Click "Environment Variables..." at the bottom right
  3. In the bottom "System variables" pane, select "Path" and click "Edit..."
  4. 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

OpenSSL

Get OpenSSL

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

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>

Build OpenSSL

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

Qt

You should already have Qt Sources downloaded per the prerequisites, so navigate to your Qt source folder (default C:\Qt\<YOUR_QT_VERSION>\Src)

Configure Qt

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

Build Qt

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

You can now build qView in Qt Creator with your static Qt build as your selected Qt version, and it will create a static qView build.

Clone this wiki locally