Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-121419

Cant compile the sources with openssl 3.0 on Visual Studio

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 6.6.1
    • Build System, Network: SSL
    • None
    • Windows 10
    • Windows

    Description

      I'm trying to compile the Qt source 6.6.1 with OpenSSL 3.0, i have compiled the OpenSSL source openssl-3.2.0
      and i have set the folder to the PATH variable `C:\Program Files\OpenSSL` it successfully enabled the 3.0 option in the config log:
       

      Support enabled for:
        Using pkg-config ....................... no
        Using vcpkg ............................ yes
        udev ................................... no
        OpenSSL ................................ yes
          Qt directly linked to OpenSSL ........ no
        OpenSSL 1.1 ............................ no
        OpenSSL 3.0 ............................ yes

       
      However, now when compiling the source I'm getting a lot of redefinition errors on `winsock.h` and `winsock2.h` files:

      C:\Qt\w6.6.0>cmake --build . --parallel
      [2307/19563] Building CXX object qtbase\src\plugins\tls\op...ndOpenSSLPlugin.dir\RelWithDebInfo\qtlskey_openssl.cpp.obj
      FAILED: qtbase/src/plugins/tls/openssl/CMakeFiles/QTlsBackendOpenSSLPlugin.dir/RelWithDebInfo/qtlskey_openssl.cpp.obj
      C:\PROGRA~1\MICROS~1\2022\Preview\VC\Tools\MSVC\1439~1.334\bin\Hostx64\x64\cl.exe  /nologo /TP DNOMINMAX -DOPENSSL_API_COMPAT=0x10100000L -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_UP_TO=0x040800 -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_LEAN_HEADERS=1 -DQT_NETWORK_LIB -DQT_NO_AS_CONST -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QEXCHANGE -DQT_PLUGIN -DQT_WARN_DEPRECATED_UP_TO=0x070000 -DQTlsBackendOpenSSLPlugin_EXPORTS -DUNICODE -DWIN32 -DWIN64 -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN64 -DCMAKE_INTDIR=\"RelWithDebInfo\" -IC:\Qt\w6.6.0\qtbase\src\plugins\tls\openssl\QTlsBackendOpenSSLPlugin_autogen\include_RelWithDebInfo -IC:\Qt\w6.6.0\qtbase\src\plugins\tls\openssl -IC:\Qt\w6.6.0\qtbase\include -I"C:\Program Files\OpenSSL\include" -IC:\Qt\w6.6.0\qtbase\src\network -IC:\Qt\w6.6.0\qtbase\include\QtNetwork\6.6.1 -IC:\Qt\w6.6.0\qtbase\include\QtNetwork\6.6.1\QtNetwork -IC:\Qt\w6.6.0\qtbase\src\corelib -IC:\Qt\w6.6.0\qtbase\include\QtCore\6.6.1 -IC:\Qt\w6.6.0\qtbase\include\QtCore\6.6.1\QtCore -IC:\Qt\w6.6.0\qtbase\include\QtCore -IC:\Qt\w6.6.0\qtbase\mkspecs\win32-msvc -IC:\Qt\w6.6.0\qtbase\include\QtNetwork /DWIN32 /D_WINDOWS /Zi     /DNDEBUG -O2 -Ob3 -std:c++17 -MD /W3 /EHs-c /wd4530 /wd4577 Zc:__cplusplus -permissive -utf-8 -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:ternary -Zc:externConstexpr -Zc:wchar_t -bigobj -guard:cf -Gw /showIncludes /Foqtbase\src\plugins\tls\openssl\CMakeFiles\QTlsBackendOpenSSLPlugin.dir\RelWithDebInfo\qtlskey_openssl.cpp.obj /Fdqtbase\src\plugins\tls\openssl\CMakeFiles\QTlsBackendOpenSSLPlugin.dir\RelWithDebInfo\ /FS -c C:\Qt\w6.6.0\qtbase\src\plugins\tls\openssl\qtlskey_openssl.cpp
      C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\ws2def.h(103): warning C4005: 'AF_IPX': macro redefinition
      C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winsock.h(457): note: see previous definition of 'AF_IPX'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\ws2def.h(147): warning C4005: 'AF_MAX': macro redefinition
      C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winsock.h(476): note: see previous definition of 'AF_MAX'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\ws2def.h(187): warning C4005: 'SO_DONTLINGER': macro redefinition
      C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winsock.h(399): note: see previous definition of 'SO_DONTLINGER'
      C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\ws2def.h(240): error C2011: 'sockaddr': 'struct' type redefinition
      C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\winsock.h(482): note: see declaration of 'sockaddr'

       
      The full log can be found here
       
      I'm compiling using Visual Studio 2022 Developer Command Prompt v17.9.0-pre.3.0 with the following command:

       

      configure.bat -debug-and-release -platform win32-msvc -opensource -confirm-license -force-debug-info -webengine-proprietary-codecs -feature-vulkan -no-schannel -openssl-runtime -prefix "C:\Qt\w6.6.0"

       
      After some research, i found this [answer|https://stackoverflow.com/a/11727055] that suggests a problem in the order of the includes.

      I wonder if i'm missing something in the configure.bat command or if its a problem in the Qt source code.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              leonn Rob Beth
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes