Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Static Compile Qt 5.13.1 with OpenSSL 1.1.1d using MinGW (in Windows 10)

    Installation and Deployment
    qt5.13 openssl compile compile-errors qmake
    3
    3
    3801
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • CybeX
      CybeX last edited by

      Re: Static compilation. Qt 5.12.3

      Good day

      Qt Forum suggested I create a new post as the linked one is 'quite old'

      This essentially serves as a confirmation of some 'bug', what the exact problem is I am not sure, but I can simply provide you with my compile script and the error.

      The purpose is to compile OpenSSL against Qt, which will allow me to compile a single all-in-one binary application I can ship. I was able to achieve this but had inconsistency issues, thus bringing me back to the recompilation side.

      The error compilation line repeating is shown below:

      ..\..\..\..\include\QtWindowsUIAutomationSupport\5.13.1/QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h:1:10: fatal error: ../../../../../src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h: No such file or directory
       #include "../../../../../src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h"
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      

      Question:

      How can I statically compile Qt with OpenSSL?

      Further additional details below:
      My Setup Environment:

      • Using MinGW32 for compilation
      • Using OpenSSL 1.1.1d precompiled downloadable from here, it has MinGW libs which I link to, shown further down in the post.
      • PATH has the OpenSSL /bin added with version OpenSSL 1.1.1d 10 Sep 2019

      The script I am using to compile Qt can be found here, provided by Qt on this page. For the addition of OpenSSL, I am using this as a guide.

      My compile scirpt configuration is:

          $QtSrcUrl = "F:\Qt\Static-OpenSSL-Linked\src\qt-everywhere-src-5.13.1.tar",
          $QtStaticDir = "F:\Qt\Static-OpenSSL-Linked",
          $QtVersion = "",
          $arch = "32",
          $MingwDir = "",
          $threads = "16",
          $OPENSSL_HOME = "C:\OpenSSL\OpenSSL-Win$($arch)",
      
          set OPENSSL_LIBS="-lssl -lcrypto"
          cmd /c "configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir `
              -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-sqlite -openssl-linked -I $($OPENSSL_HOME)\include -L$($OPENSSL_HOME)\lib\MinGW `
              -opensource -confirm-license `
              -make libs -nomake tools -nomake examples -nomake tests"
          cmd /c "mingw32-make -k -j$($threads)"
      

      I already have OpenSSL installed at

      PS C:\OpenSSL\OpenSSL-Win32> ls
      
      Directory: C:\OpenSSL\OpenSSL-Win32
      
      Mode                LastWriteTime         Length Name
      ----                -------------         ------ ----
      d-----       2019/09/30     07:27                bin
      d-----       2019/09/30     07:27                exp
      d-----       2019/09/30     07:27                include
      d-----       2019/09/30     07:27                lib
      d-----       2019/09/30     07:27                tests
      -a----       2019/09/11     18:10             89 acknowledgements.txt
      -a----       2019/09/11     18:10            752 authors.txt
      -a----       2019/09/11     18:10         596279 changes.txt
      -a----       2019/09/11     18:10           6408 c_rehash.pl
      -a----       2019/09/11     18:10             86 faq.txt
      -a----       2019/09/11     18:10        2515456 libcrypto-1_1.dll
      -a----       2019/09/11     18:10         530432 libssl-1_1.dll
      -a----       2019/09/11     18:10           6246 license.txt
      -a----       2019/09/11     18:10          43136 news.txt
      -a----       2019/09/11     18:10           3251 readme.txt
      -a----       2019/09/30     07:27          96904 unins000.dat
      -a----       2019/09/30     07:26         730789 unins000.exe
      

      I saw some posts refering to %OPENSSL_HOME% and %OPENSSL_HOME%\libs and using an env variable set as

      OPENSSL_LIBS="-lssl -lcrypto"
      

      which I tried, but always complained that "-lssl" could not be found. Thus I opted for the following dir, and it appeared to work correctly and picked up -lssl -lcrypto (not sure if this may be an accomplice with the compilation issue).

      PS C:\OpenSSL\OpenSSL-Win32\lib\MinGW> ls
      
          Directory: C:\OpenSSL\OpenSSL-Win32\lib\MinGW
      
      Mode                LastWriteTime         Length Name
      ----                -------------         ------ ----
      -a----       2019/09/11     18:11        3347286 libcrypto.a
      -a----       2019/09/11     18:10         109020 libcrypto.def
      -a----       2019/09/11     18:11         385126 libssl.a
      -a----       2019/09/11     18:10          14033 libssl.def
      

      Configuration Summary: (the important bit)

      Qt Network:
        getifaddrs() ........................... no
        IPv6 ifname ............................ no
        libproxy ............................... no
        Schannel ............................... no
        OpenSSL ................................ yes
          Qt directly linked to OpenSSL ........ yes
        OpenSSL 1.1 ............................ yes
        DTLS ................................... yes
        OCSP-stapling .......................... yes
        SCTP ................................... no
        Use system proxies ..................... yes
      

      Further examples of the error line can be seen below:

      In file included from uiautomation\qwindowsuiabaseprovider.h:50:0,
                       from uiautomation\qwindowsuiabaseprovider.cpp:43:
      ..\..\..\..\include\QtWindowsUIAutomationSupport\5.13.1/QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h:1:10: fatal error: ../../../../../src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h: No such file or directory
       #include "../../../../../src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h"
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      mingw32-make[6]: *** [Makefile.Debug:11357: .obj/debug/qwindowsuiabaseprovider.o] Error 1
      g++ -c -fno-keep-inline-dllexport -g -Og -std=c++1z -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -ffunction-sections -fdata-sections -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_STATIC_BUILD -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_CAST_FROM_ASCII -DQT_NO_FOREACH -DLIBEGL_NAME=libEGL -DLIBGLESV2_NAME=libGLESv2 -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_EVENTDISPATCHER_SUPPORT_LIB -DQT_FONTDATABASE_SUPPORT_LIB -DQT_THEME_SUPPORT_LIB -DQT_ACCESSIBILITY_SUPPORT_LIB -DQT_WINDOWSUIAUTOMATION_SUPPORT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_PLUGIN_RESOURCE_INIT_FUNCTION=qwindowsd_plugin_resource_init -I. -I. -I..\..\..\3rdparty\wintab -I..\..\..\..\include -I..\..\..\..\include\QtEventDispatcherSupport -I..\..\..\..\include\QtEventDispatcherSupport\5.13.1 -I..\..\..\..\include\QtEventDispatcherSupport\5.13.1\QtEventDispatcherSupport -I..\..\..\..\include\QtFontDatabaseSupport -I..\..\..\..\include\QtFontDatabaseSupport\5.13.1 -I..\..\..\..\include\QtFontDatabaseSupport\5.13.1\QtFontDatabaseSupport -I..\..\..\..\include\QtThemeSupport -I..\..\..\..\include\QtThemeSupport\5.13.1 -I..\..\..\..\include\QtThemeSupport\5.13.1\QtThemeSupport -I..\..\..\..\include\QtAccessibilitySupport -I..\..\..\..\include\QtAccessibilitySupport\5.13.1 -I..\..\..\..\include\QtAccessibilitySupport\5.13.1\QtAccessibilitySupport -I..\..\..\..\include\QtWindowsUIAutomationSupport -I..\..\..\..\include\QtWindowsUIAutomationSupport\5.13.1 -I..\..\..\..\include\QtWindowsUIAutomationSupport\5.13.1\QtWindowsUIAutomationSupport -I..\..\..\..\include\QtGui\5.13.1 -I..\..\..\..\include\QtGui\5.13.1\QtGui -I..\..\..\..\include\QtGui -I..\..\..\..\include\QtCore\5.13.1 -I..\..\..\..\include\QtCore\5.13.1\QtCore -I..\..\..\..\include\QtCore -I.moc\debug -IC:\OpenSSL\OpenSSL-Win32\include -I..\..\..\..\mkspecs\win32-g++  -o .obj\debug\qwindowsuiavalueprovider.o uiautomation\qwindowsuiavalueprovider.cpp
      

      and another example

      In file included from ..\windows\uiautomation\qwindowsuiabaseprovider.h:50:0,
                       from ..\windows\uiautomation\qwindowsuiagriditemprovider.h:46,
                       from ..\windows\uiautomation\qwindowsuiagriditemprovider.cpp:43:
      ..\..\..\..\include\QtWindowsUIAutomationSupport\5.13.1/QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h:1:10: fatal error: ../../../../../src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h: No such file or directory
       #include "../../../../../src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h"
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      mingw32-make[6]: *** [Makefile.Debug:14323: .obj/debug/qwindowsuiagriditemprovider.o] Error 1
      g++ -c -fno-keep-inline-dllexport -g -Og -std=c++1z -fno-exceptions -Wall -W -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -ffunction-sections -fdata-sections -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_STATIC_BUILD -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_CAST_FROM_ASCII -DQT_NO_FOREACH -DLIBEGL_NAME=libEGL -DLIBGLESV2_NAME=libGLESv2 -DQT_DEPRECATED_WARNINGS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_EXCEPTIONS -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_EVENTDISPATCHER_SUPPORT_LIB -DQT_FONTDATABASE_SUPPORT_LIB -DQT_THEME_SUPPORT_LIB -DQT_ACCESSIBILITY_SUPPORT_LIB -DQT_WINDOWSUIAUTOMATION_SUPPORT_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_PLUGIN_RESOURCE_INIT_FUNCTION=qdirect2dd_plugin_resource_init -I. -I..\windows -I..\..\..\3rdparty\wintab -I..\..\..\..\include -I..\..\..\..\include\QtEventDispatcherSupport -I..\..\..\..\include\QtEventDispatcherSupport\5.13.1 -I..\..\..\..\include\QtEventDispatcherSupport\5.13.1\QtEventDispatcherSupport -I..\..\..\..\include\QtFontDatabaseSupport -I..\..\..\..\include\QtFontDatabaseSupport\5.13.1 -I..\..\..\..\include\QtFontDatabaseSupport\5.13.1\QtFontDatabaseSupport -I..\..\..\..\include\QtThemeSupport -I..\..\..\..\include\QtThemeSupport\5.13.1 -I..\..\..\..\include\QtThemeSupport\5.13.1\QtThemeSupport -I..\..\..\..\include\QtAccessibilitySupport -I..\..\..\..\include\QtAccessibilitySupport\5.13.1 -I..\..\..\..\include\QtAccessibilitySupport\5.13.1\QtAccessibilitySupport -I..\..\..\..\include\QtWindowsUIAutomationSupport -I..\..\..\..\include\QtWindowsUIAutomationSupport\5.13.1 -I..\..\..\..\include\QtWindowsUIAutomationSupport\5.13.1\QtWindowsUIAutomationSupport -I..\..\..\..\include\QtGui\5.13.1 -I..\..\..\..\include\QtGui\5.13.1\QtGui -I..\..\..\..\include\QtGui -I..\..\..\..\include\QtCore\5.13.1 -I..\..\..\..\include\QtCore\5.13.1\QtCore -I..\..\..\..\include\QtCore -I.moc\debug -IC:\OpenSSL\OpenSSL-Win32\include -I..\..\..\..\mkspecs\win32-g++  -o .obj\debug\qwindowsuiawindowprovider.o ..\windows\uiautomation\qwindowsuiawindowprovider.cpp
      

      The last few lines before compilation completion, I have this:

      F:\Qt\Static-OpenSSL-Linked\src\qt-everywhere-src-5.13.1\qtbase\bin\qmake.exe -install qinstall F:\Qt\Static-OpenSSL-Linked\src\qt-everywhere-src-5.13.1\qtbase\mkspecs\winrt-x86-msvc2017 F:\Qt\Static-OpenSSL-Linked\5.13.1_x32\mkspecs\winrt-x86-msvc2017
      F:\Qt\Static-OpenSSL-Linked\src\qt-everywhere-src-5.13.1\qtbase\bin\qmake.exe -install qinstall F:\Qt\Static-OpenSSL-Linked\src\qt-everywhere-src-5.13.1\qtbase\mkspecs\winrt-x86-msvc2019 F:\Qt\Static-OpenSSL-Linked\5.13.1_x32\mkspecs\winrt-x86-msvc2019
      mingw32-make[1]: Target 'install' not remade because of errors.
      mingw32-make[1]: Leaving directory 'F:/Qt/Static-OpenSSL-Linked/src/qt-everywhere-src-5.13.1/qtbase'
      mingw32-make: *** [Makefile:94: module-qtbase-install_subtargets] Error 2
      mingw32-make: Target 'install' not remade because of errors.
      

      Configuration Summary:

      Build type: win32-g++ (i386, CPU features: <none>)
      Compiler: gcc 7.3.0
      Configuration: sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples f16c largefile optimize_debug precompile_header rdrnd shani x86SimdAlways debug_and_release release debug build_all c++11 c++14 c++1z concurrent dbus no-pkg-config release_tools static stl
      Build options:
        Mode ................................... debug and release; default link: debug; optimized tools
        Optimize debug build ................... yes
        Optimize release build for size ........ no
        Building shared libraries .............. no
        Using C standard ....................... C11
        Using C++ standard ..................... C++17
        Generating GDB index ................... no
        Using precompiled headers .............. yes
        Using LTCG ............................. no
        Target compiler supports:
          SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
          AVX .................................. AVX AVX2
          AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI
          Other x86 ............................ AES F16C RDRAND SHA
          Intrinsics without -mXXX option ...... yes
        Build parts ............................ libs
        App store compliance ................... no
      Qt modules and options:
        Qt Concurrent .......................... yes
        Qt D-Bus ............................... yes
        Qt D-Bus directly linked to libdbus .... no
        Qt Gui ................................. yes
        Qt Network ............................. yes
        Qt Sql ................................. yes
        Qt Testlib ............................. yes
        Qt Widgets ............................. yes
        Qt Xml ................................. yes
      Support enabled for:
        Using pkg-config ....................... no
        udev ................................... no
        Using system zlib ...................... no
        Zstandard support ...................... no
      Qt Core:
        DoubleConversion ....................... yes
          Using system DoubleConversion ........ no
        GLib ................................... no
        iconv .................................. no
        ICU .................................... no
        Built-in copy of the MIME database ..... yes
        Tracing backend ........................ <none>
        Logging backends:
          journald ............................. no
          syslog ............................... no
          slog2 ................................ no
        Using system PCRE2 ..................... no
      Qt Network:
        getifaddrs() ........................... no
        IPv6 ifname ............................ no
        libproxy ............................... no
        Schannel ............................... no
        OpenSSL ................................ yes
          Qt directly linked to OpenSSL ........ yes
        OpenSSL 1.1 ............................ yes
        DTLS ................................... yes
        OCSP-stapling .......................... yes
        SCTP ................................... no
        Use system proxies ..................... yes
      Qt Gui:
        Accessibility .......................... yes
        FreeType ............................... yes
          Using system FreeType ................ no
        HarfBuzz ............................... yes
          Using system HarfBuzz ................ no
        Fontconfig ............................. no
        Image formats:
          GIF .................................. yes
          ICO .................................. yes
          JPEG ................................. yes
            Using system libjpeg ............... no
          PNG .................................. yes
            Using system libpng ................ no
        EGL .................................... no
        OpenVG ................................. no
        OpenGL:
          ANGLE ................................ no
          Desktop OpenGL ....................... yes
          Dynamic OpenGL ....................... no
          OpenGL ES 2.0 ........................ no
          OpenGL ES 3.0 ........................ no
          OpenGL ES 3.1 ........................ no
          OpenGL ES 3.2 ........................ no
        Vulkan ................................. no
        Session Management ..................... yes
      Features used by QPA backends:
        evdev .................................. no
        libinput ............................... no
        INTEGRITY HID .......................... no
        mtdev .................................. no
        tslib .................................. no
        xkbcommon .............................. no
        X11 specific:
          XLib ................................. no
          XCB Xlib ............................. no
          EGL on X11 ........................... no
      QPA backends:
        DirectFB ............................... no
        EGLFS .................................. no
        LinuxFB ................................ no
        VNC .................................... no
        Mir client ............................. no
        Windows:
          Direct 2D ............................ yes
          DirectWrite .......................... yes
          DirectWrite 2 ........................ yes
      Qt Sql:
        SQL item models ........................ yes
      Qt Widgets:
        GTK+ ................................... no
        Styles ................................. Fusion Windows WindowsVista
      Qt PrintSupport:
        CUPS ................................... no
      Qt Sql Drivers:
        DB2 (IBM) .............................. no
        InterBase .............................. no
        MySql .................................. no
        OCI (Oracle) ........................... no
        ODBC ................................... yes
        PostgreSQL ............................. no
        SQLite2 ................................ no
        SQLite ................................. yes
          Using system provided SQLite ......... no
        TDS (Sybase) ........................... no
      Qt Testlib:
        Tester for item models ................. yes
      Qt SerialBus:
        Socket CAN ............................. no
        Socket CAN FD .......................... no
        SerialPort Support ..................... yes
      Further Image Formats:
        JasPer ................................. no
        MNG .................................... no
        TIFF ................................... yes
          Using system libtiff ................. no
        WEBP ................................... yes
          Using system libwebp ................. no
      Qt QML:
        QML network support .................... yes
        QML debugging and profiling support .... yes
        QML tracing JIT support ................ no
        QML sequence object .................... yes
        QML list model ......................... yes
        QML XML http request ................... yes
        QML Locale ............................. yes
        QML delegate model ..................... yes
      Qt Quick:
        Direct3D 12 ............................ no
        AnimatedImage item ..................... yes
        Canvas item ............................ yes
        Support for Qt Quick Designer .......... yes
        Flipable item .......................... yes
        GridView item .......................... yes
        ListView item .......................... yes
        TableView item ......................... yes
        Path support ........................... yes
        PathView item .......................... yes
        Positioner items ....................... yes
        Repeater item .......................... yes
        ShaderEffect item ...................... yes
        Sprite item ............................ yes
      Qt Scxml:
        ECMAScript data model for QtScxml ...... yes
      Qt Gamepad:
        SDL2 ................................... no
      Qt 3D:
        Assimp ................................. yes
        System Assimp .......................... no
        Output Qt3D Job traces ................. no
        Output Qt3D GL traces .................. no
        Use SSE2 instructions .................. no
        Use AVX2 instructions .................. no
        Aspects:
          Render aspect ........................ yes
          Input aspect ......................... yes
          Logic aspect ......................... yes
          Animation aspect ..................... yes
          Extras aspect ........................ yes
      Qt 3D Renderers:
        OpenGL Renderer ........................ yes
      Qt 3D GeometryLoaders:
        Autodesk FBX ........................... no
      Qt Wayland Client ........................ no
      Qt Wayland Compositor .................... no
      Qt Bluetooth:
        BlueZ .................................. no
        BlueZ Low Energy ....................... no
        Linux Crypto API ....................... no
        WinRT Bluetooth API (desktop & UWP) .... no
        WinRT advanced bluetooth low energy API (desktop & UWP) . no
      Qt Sensors:
        sensorfw ............................... no
      Qt Quick Controls 2:
        Styles ................................. Default Fusion Imagine Material Universal
      Qt Quick Templates 2:
        Hover support .......................... yes
        Multi-touch support .................... yes
      Qt Positioning:
        Gypsy GPS Daemon ....................... no
        WinRT Geolocation API .................. no
      Qt Location:
        Qt.labs.location experimental QML plugin . yes
        Geoservice plugins:
          OpenStreetMap ........................ yes
          HERE ................................. yes
          Esri ................................. yes
          Mapbox ............................... yes
          MapboxGL ............................. yes
          Itemsoverlay ......................... yes
      QtXmlPatterns:
        XML schema support ..................... yes
      Qt Multimedia:
        ALSA ................................... no
        GStreamer 1.0 .......................... no
        GStreamer 0.10 ......................... no
        Video for Linux ........................ no
        OpenAL ................................. no
        PulseAudio ............................. no
        Resource Policy (libresourceqt5) ....... no
        Windows Audio Services ................. no
        DirectShow ............................. yes
        Windows Media Foundation ............... no
      Qt Tools:
        QDoc ................................... no
      Qt WebEngineCore:
        Qt WebEngine Widgets ................... yes
        Qt WebEngine Qml ....................... yes
        Embedded build ......................... no
        Full debug information ................. no
        Pepper Plugins ......................... yes
        Printing and PDF ....................... yes
        Proprietary Codecs ..................... no
        Spellchecker ........................... yes
        Native Spellchecker .................... no
        WebRTC ................................. yes
        Use System Ninja ....................... no
        Geolocation ............................ yes
        WebChannel support ..................... yes
        Use v8 snapshot ........................ yes
        Kerberos Authentication ................ yes
        Extensions ............................. yes
      Qt WebEngineQml:
        UI Delegates ........................... yes
        Test Support ........................... no
      
      Note: Using static linking will disable the use of dynamically
      loaded plugins. Make sure to import all needed static plugins,
      or compile needed modules into the library.
      
      Note: When linking against OpenSSL, you can override the default
      library names through OPENSSL_LIBS.
      For example:
          OPENSSL_LIBS='-L/opt/ssl/lib -lssl -lcrypto' ./configure -openssl-linked
      
      Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.
      
      WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.
      
      1 Reply Last reply Reply Quote 0
      • S
        sergitab94 last edited by sergitab94

        You need to add in %PATH% the folders: bin, lib and include. You shouldn't install that precompiled version from slproweb.com, it has dynamic libraries. You should download and compile a static version openssl. And you should add flags in .\configure.bat with OPENSSL_LIBS="-llibssl -llibcrypto -lcrypt32 -lgdi32 -lws2_32". LibSSL and LibCrypto is files (main library) and crypt32, gdi32, ws2_32 is a sublibraries (it are in the main file).

        I created a small script to do an almost unattended install and modified other script. I will also leave all the instructions in the simplest way that has occurred to me.

        1º- Install msys2 (used for compile OpenSSL), 7zip and Qt with MinGW for section "Developer and Designer Tools" (if possible the compiler version that matches the one compiled for development)

        2º- Update msys2 with pacman -Syu and pacman -Su (if it needed, close msys2 and rewrite)

        3º- Download OpenSSL from official page https://www.openssl.org/source/ (In your case, openssl-1.1.1d.tar.gz) and descompress folder with 7zip

        4º- Include the next script into folder (extension end in .sh):

        #!/bin/bash
        pacman -S perl mingw-w64-x86_64-gcc make --noconfirm --needed 
        pacman -Syu --noconfirm
        mkdir -p /c/openssl
        ./Configure --prefix=/c/openssl --openssldir=/c/openssl no-shared --release mingw64
        make depend && make && make install_sw
        

        5º- Execute "MSYS2 MinGW 64-bit" and go to the folder with command cd /c/pathToFolder and execute the script with command ./nameScript.sh

        6º- Execute the next script in PowerShell 3.0 or higher (update $QtSrcUrl if you need a version higer). Extension end in .ps1

        #-----------------------------------------------------------------------------
        # 
        #  Copyright (c) 2013, Thierry Lelegard
        #  All rights reserved.
        # 
        #  Redistribution and use in source and binary forms, with or without
        #  modification, are permitted provided that the following conditions are met:
        # 
        #  1. Redistributions of source code must retain the above copyright notice,
        #     this list of conditions and the following disclaimer. 
        #  2. Redistributions in binary form must reproduce the above copyright
        #     notice, this list of conditions and the following disclaimer in the
        #     documentation and/or other materials provided with the distribution. 
        # 
        #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        #  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        #  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        #  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
        #  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
        #  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
        #  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
        #  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
        #  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        #  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
        #  THE POSSIBILITY OF SUCH DAMAGE.
        # 
        #-----------------------------------------------------------------------------
        
        <#
         .SYNOPSIS
        
          Build a static version of Qt for Windows.
        
         .DESCRIPTION
        
          This scripts downloads Qt source code, compiles and installs a static version
          of Qt. It assumes that a prebuilt Qt / MinGW environment is already installed,
          typically in C:\Qt. This prebuilt environment uses shared libraries. It is
          supposed to remain the main development environment for Qt. This script adds
          a static version of the Qt libraries in order to allow the construction of
          standalone and self-sufficient executable.
        
          This script is typically run from the Windows Explorer.
        
          Requirements:
          - Windows PowerShell 3.0 or higher.
          - 7-zip.
        
         .PARAMETER QtSrcUrl
        
          URL of the Qt source file archive.
          By default, use the latest identified version.
        
         .PARAMETER QtStaticDir
        
          Root directory where the static versions of Qt are installed.
          By default, use C:\Qt\Static.
        
         .PARAMETER QtVersion
        
          The Qt version. By default, this script tries to extract the version number
          from the Qt source file name.
        
         .PARAMETER MingwDir
        
          Root directory of the MinGW prebuilt environment. By default, use the version
          which was installed by the prebuilt Qt environment.
        
         .PARAMETER NoPause
        
          Do not wait for the user to press <enter> at end of execution. By default,
          execute a "pause" instruction at the end of execution, which is useful
          when the script was run from Windows Explorer.
        #>
        
        [CmdletBinding()]
        param(
            $QtSrcUrl = "http://download.qt-project.org/official_releases/qt/5.14/5.14.1/single/qt-everywhere-src-5.14.1.zip",
            $open = "C:\openssl",
            $QtStaticDir = "C:\Qt\Static",
            $QtVersion = "",
            $MingwDir = "",
            [switch]$NoPause = $false
        )
        
        # PowerShell execution policy.
        Set-StrictMode -Version 3
        
        #-----------------------------------------------------------------------------
        # Main code
        #-----------------------------------------------------------------------------
        
        function Main
        {
            # Check that 7zip is installed. We use it to expand the downloaded archive.
            [void] (Get-7zip)
        
            # Get Qt source file name from URL.
            $QtSrcFileName = Split-Path -Leaf $QtSrcUrl
        
            # If Qt version is not specified on the command line, try to extract the value.
            if (-not $QtVersion) {
                $QtVersion = $QtSrcFileName -replace "`.[^`.]*$",''
                $QtVersion = $QtVersion -replace 'qt-',''
                $QtVersion = $QtVersion -replace 'everywhere-',''
                $QtVersion = $QtVersion -replace 'opensource-',''
                $QtVersion = $QtVersion -replace 'src-',''
                $QtVersion = $QtVersion -replace '-src',''
            }
            Write-Output "Building static Qt version $QtVersion"
        
            # Qt installation directory.
            $QtDir = "$QtStaticDir\$QtVersion"
        
            # Get MinGW root directory, if not specified on the command line.
            if (-not $MingwDir) {
                # Search all instances of gcc.exe from C:\Qt prebuilt environment.
                $GccList = @(Get-ChildItem -Path C:\Qt\Tools\mingw*\bin\gcc.exe | ForEach-Object FullName | Sort-Object)
                if ($GccList.Length -eq 0) {
                    Exit-Script "MinGW environment not found, no Qt prebuilt version?"
                }
                $MingwDir = (Split-Path -Parent (Split-Path -Parent $GccList[$GccList.Length - 1]))
            }
            Write-Output "Using MinGW from $MingwDir"
        
            # Build the directory tree where the static version of Qt will be installed.
            Create-Directory $QtStaticDir\src
            Create-Directory $QtDir
        
            # Download the Qt source package if not yet done.
            Download-File $QtSrcUrl $QtStaticDir\src\$QtSrcFileName
        
            # Directory of expanded packages.
            $QtSrcDir = "$QtStaticDir\src\$((Get-Item $QtStaticDir\src\$QtSrcFileName).BaseName)"
        
            # Expand archives if not yet done
            Expand-Archive $QtStaticDir\src\$QtSrcFileName $QtStaticDir\src $QtSrcDir
        
            # Patch Qt's mkspecs for static build.
            $File = "$QtSrcDir\qtbase\mkspecs\win32-g++\qmake.conf"
            if (-not (Select-String -Quiet -SimpleMatch -CaseSensitive "# [QT-STATIC-PATCH]" $File)) {
                Write-Output "Patching $File ..."
                Copy-Item $File "$File.orig"
                @"
        
        # [QT-STATIC-PATCH]
        QMAKE_LFLAGS += -static -static-libgcc
        QMAKE_CFLAGS_RELEASE -= -O2
        QMAKE_CFLAGS_RELEASE += -Os -momit-leaf-frame-pointer
        DEFINES += QT_STATIC_BUILD
        "@ | Out-File -Append $File -Encoding Ascii
            }
        
            # Set a clean path including MinGW.
            $env:Path = "$open\bin;$open\lib;$open\include;$MingwDir\bin;$MingwDir\opt\bin;$env:SystemRoot\system32;$env:SystemRoot"
        
            # Force English locale to avoid weird effects of tools localization.
            $env:LANG = "en"
        
            # Set environment variable QT_INSTALL_PREFIX. Documentation says it should be
            # used by configure as prefix but this does not seem to work. So, we will
            # also specify -prefix option in configure.
            $env:QT_INSTALL_PREFIX = $QtDir
        	
        	$env:INCLUDE="$open\include"
        	$env:LIB="$open\lib"
        
            # Configure, compile and install Qt.
            Push-Location $QtSrcDir	
            cmd /c "configure.bat -static -release -platform win32-g++ -prefix $QtDir -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sqlite -opensource -confirm-license -make libs -nomake examples -nomake tests -ssl -openssl -openssl-linked -I `"$open\include`" -L `"$open\lib`" OPENSSL_LIBS=`"-llibssl -llibcrypto -lcrypt32 -lgdi32 -lws2_32`""
            mingw32-make -k -j4
            mingw32-make -k install
            Pop-Location
        
            # Patch Qt's installed mkspecs for static build of application.
            $File = "$QtDir\mkspecs\win32-g++\qmake.conf"
            @"
        CONFIG += static
        "@ | Out-File -Append $File -Encoding Ascii
        
            Exit-Script
        }
        
        #-----------------------------------------------------------------------------
        # A function to exit this script. The Message parameter is used on error.
        #-----------------------------------------------------------------------------
        
        function Exit-Script ([string]$Message = "")
        {
            $Code = 0
            if ($Message -ne "") {
                Write-Output "ERROR: $Message"
                $Code = 1
            }
            if (-not $NoPause) {
                pause
            }
            exit $Code
        }
        
        #-----------------------------------------------------------------------------
        # Silently create a directory.
        #-----------------------------------------------------------------------------
        
        function Create-Directory ([string]$Directory)
        {
            [void] (New-Item -Path $Directory -ItemType "directory" -Force)
        }
        
        #-----------------------------------------------------------------------------
        # Download a file if not yet present.
        # Warning: If file is present but incomplete, do not download it again.
        #-----------------------------------------------------------------------------
        
        function Download-File ([string]$Url, [string]$OutputFile)
        {
            $FileName = Split-Path $Url -Leaf
            if (-not (Test-Path $OutputFile)) {
                # Local file not present, start download.
                Write-Output "Downloading $Url ..."
                try {
                    $webclient = New-Object System.Net.WebClient
                    $webclient.DownloadFile($Url, $OutputFile)
                }
                catch {
                    # Display exception.
                    $_
                    # Delete partial file, if any.
                    if (Test-Path $OutputFile) {
                        Remove-Item -Force $OutputFile
                    }
                    # Abort
                    Exit-Script "Error downloading $FileName"
                }
                # Check that the file is present.
                if (-not (Test-Path $OutputFile)) {
                    Exit-Script "Error downloading $FileName"
                }
            }
        }
        
        #-----------------------------------------------------------------------------
        # Get path name of 7zip, abort if not found.
        #-----------------------------------------------------------------------------
        
        function Get-7zip
        {
            $Exe = "C:\Program Files\7-Zip\7z.exe"
            if (-not (Test-Path $Exe)) {
                $Exe = "C:\Program Files (x86)\7-Zip\7z.exe"
            }
            if (-not (Test-Path $Exe)) {
                Exit-Script "7-zip not found, install it first, see http://www.7-zip.org/"
            }
            $Exe
        }
        
        #-----------------------------------------------------------------------------
        # Expand an archive file if not yet done.
        #-----------------------------------------------------------------------------
        
        function Expand-Archive ([string]$ZipFile, [string]$OutDir, [string]$CheckFile)
        {
            # Check presence of expected expanded file or directory.
            if (-not (Test-Path $CheckFile)) {
                Write-Output "Expanding $ZipFile ..."
                & (Get-7zip) x $ZipFile "-o$OutDir" | Select-String -Pattern "^Extracting " -CaseSensitive -NotMatch
                if (-not (Test-Path $CheckFile)) {
                    Exit-Script "Error expanding $ZipFile, $OutDir\$CheckFile not found"
                }
            }
        }
        
        #-----------------------------------------------------------------------------
        # Execute main code.
        #-----------------------------------------------------------------------------
        
        . Main
        

        7º- End of install. Add compiler to QT Creator. ;)

        If you need more help (to add it in Qt Creator) visit the next video for simple install static (without OpenSSL): https://youtu.be/lwX_urJJOf8

        Your issue helped me understand where it failed. That's why I wanted to help you and everyone who encountered this issue. Thank you.

        xenovas 1 Reply Last reply Reply Quote 0
        • xenovas
          xenovas @sergitab94 last edited by

          @sergitab94 Sorry for this reply I know this is an old post, but I followed your steps one by one but still my build fails.
          Anyway opennssl static build with Qt really frustrated me...

          C:\Qt\Static5113OpenSSL\src\qt-everywhere-src-5.11.3\qtbase\bin\qmake.exe -install qinstall C:\Qt\Static5113OpenSSL\src\qt-everywhere-src-5.11.3\qtbase\mkspecs\winrt-x86-msvc2015 C:\Qt\Static5113OpenSSL\StaticOpenSSL64\mkspecs\winrt-x86-msvc2015
          C:\Qt\Static5113OpenSSL\src\qt-everywhere-src-5.11.3\qtbase\bin\qmake.exe -install qinstall C:\Qt\Static5113OpenSSL\src\qt-everywhere-src-5.11.3\qtbase\mkspecs\winrt-x86-msvc2017 C:\Qt\Static5113OpenSSL\StaticOpenSSL64\mkspecs\winrt-x86-msvc2017
          mingw32-make[1]: Target 'install' not remade because of errors.
          mingw32-make[1]: Leaving directory 'C:/Qt/Static5113OpenSSL/src/qt-everywhere-src-5.11.3/qtbase'
          mingw32-make: *** [Makefile:92: module-qtbase-install_subtargets] Error 2
          mingw32-make: Target 'install' not remade because of errors.
          

          @xen0vas

          1 Reply Last reply Reply Quote 0
          • First post
            Last post