Skip to content

Compile Qt 64 bit with OpenSSL using MinGW

Christian edited this page Jan 25, 2017 · 28 revisions

This is how we compile Qt and OpenSSL from source. The only way to compile OpenSSL on Windows that I found is using MSYS2. MSYS2 has a nice package manager so we also use this to build Qt. Download latest 64 bit msys2 package from https://sourceforge.net/projects/msys2/files/Base/x86_64/ and install it to C:\msys64. Start MSYS2 from the start menu.

Version Compability.

In it's jump to OpenSSL 1.1.0, there were a lot of changes to OpenSSL which are not compatible to Qt below 5.8 (at time of writing this, support for OpenSSL 1.1.0 was discussed for the future version Qt 5.8). So if you compile Qt 5.7 or lower, get an OpenSSL version 1.0.x.

OpenSSL

First we update package database and install some packages that we will need:

pacman -Sy
pacman -S perl mingw-w64-x86_64-gcc make tar

Now that Mingw is installed, there should be a MSYS2 Mingw64 shortcut in your start menu. Start it. Download the opensSSL sources from https://www.openssl.org/source/ (or install git and check out the lastest version). Next we will untar the sources, and build openSSL:

tar xvfz openSSL-sources.xxxx.tar.gz
cd openSSL-xxxx
mkdir dist
./Configure --prefix=$PWD/dist no-idea no-mdc2 no-rc5 shared mingw64
make depend && make && make install

OpenSSL is now compiled and installed in the previously created dist/ folder. We will now use this to compile Qt.

Qt

First we need the DirectX SDK in order to enable compilation with ANGLE. Just download it from the microsoft servers and install it (this will also install the .NET framework). Then copy the include files and library files from the SDK folder (which contains spaces) to a folder that does not contain spaces. In this example I copied them to C:\msys64\home\buildbot\directXSDK. Get the sources of Qt from https://www.qt.io/download/ or check them out using git. Then create a new folder (maybe named "Qt5.x-release" and cd to it. We will create a shadow build in this folder. Next, configure Qt to build in this new folder:

/c/Qt/5.8/Src/configure.bat -release -opensource -opengl dynamic -openssl -IC:/msys64/home/buildbot/openssl-1.0.2j/dist/include -LC:/msys64/home/buildbot/openssl-1.0.2j/dist/lib -IC:/msys64/home/buildbot/directXSDK/Include -LC:/msys64/home/buildbot/directXSDK/Lib/x86

Qt is now conficured with openSSL. Install some more packages and use it to compile Qt.

pacman -S mingw-w64-x86_64-make bison
mingw32-make

Note: If configure seems to do nothing try to delete the configure.cache first. The configure.log can give valuable insight into possible errors.