Статическая компиляция Qt 5.13.1 с -openssl-link с использованием MinGW (Windows 10) - PullRequest
0 голосов
/ 20 октября 2019

Re: Статическая компиляция. Qt 5.12.3

Добрый день

Qt Forum предложил создать новое сообщение, так как связанное является «довольно старым»

По сути, это служит подтверждением некоторой «ошибки», в чем именно проблема, я не уверен, но я могу просто предоставить вам мой скрипт компиляции и ошибку.

Цель состоит в том, чтобы скомпилировать OpenSSL с Qt, что позволит мне скомпилировать единственное двоичное приложение "все в одном", которое я могу отправить. Я смог добиться этого, но имел проблемы с несогласованностью , что вернуло меня на сторону перекомпиляции.

Повтор строки компиляции ошибок показан ниже:

..\..\..\..\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.

Вопрос:

Как я могу статически скомпилировать Qt с OpenSSL, используя флаг конфигурации -openssl-linked?


Дополнительные дополнительныеподробности ниже: Моя среда установки:

  • Использование MinGW32 для компиляции
    • Использование предварительно скомпилированного OpenSSL 1.1.1d, загружаемого из здесь , Библиотеки MinGW, на которые я ссылаюсь, показаны далее в посте .
  • PATH, добавлен OpenSSL /bin с версией OpenSSL 1.1.1d 10 Sep 2019

Сценарий, который я использую для компиляции Qt, можно найти здесь , предоставленный Qt на этой странице. Для добавления OpenSSL я использую this в качестве руководства.

Моя конфигурация scirpt компиляции:

    $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)"

У меня уже установлен OpenSSL на

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

Я видел некоторые сообщения, ссылающиеся на %OPENSSL_HOME% и %OPENSSL_HOME%\libs и использующие переменную env, установленную как

OPENSSL_LIBS="-lssl -lcrypto"

, которую я пробовал, но всегда жаловался, что "-lssl" не может бытьнашел. Таким образом, я выбрал следующий каталог, и он, кажется, работал правильно и поднял -lssl -lcrypto (не уверен, что это может быть сообщник с проблемой компиляции).

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

Сводка конфигурации: (важный бит)

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

Дополнительные примеры строки ошибки можно увидеть ниже:

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

и другой пример

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

последние несколько строк перед завершением компиляции, у меня есть это:

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.

Сводка конфигурации:

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.
...