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

statically built OpenSSL needs crypt32 and ws2_32 on Windows

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.10, 5.11
    • Build System
    • None

    Description

      Hello, everyone,

       

      For builds using mingw-w64 got errors:

      configure -v -prefix "%CD%\..\GCC64RT" -opensource -confirm-license -release -static -platform win32-g++ -static-runtime -openssl-linked OPENSSL_PREFIX="%CD%\..\..\libOPENSSL-1.1.0\GCC64RT" OPENSSL_LIBS="-llibssl -llibcrypto" -opengl dynamic && mingw32-make
      
      <snip>
      
      Checking for OpenSSL...
      Trying source 0 (type openssl) of library openssl ...
      $OPENSSL_LIBS is not set.
        => source produced no result.
      Trying source 1 (type inline) of library openssl ...
      + cd /d c:\libQT-5.11-dev\build\config.tests\openssl && c:\libQT-5.11-dev\build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" "LIBS += -Lc:\\libQT-5.11-dev\\build\\..\\..\\libOPENSSL-1.1.0\\GCC64RT/lib -llibssl -llibcrypto" "INCLUDEPATH *= c:\\libQT-5.11-dev\\build\\..\\..\\libOPENSSL-1.1.0\\GCC64RT/include" c:/libQT-5.11-dev/build/qtbase/config.tests/openssl
      + cd /d c:\libQT-5.11-dev\build\config.tests\openssl && set MAKEFLAGS=& mingw32-make
      > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -Ic:\libQT-5.11-dev\build\qtbase\config.tests\openssl -I. -Ic:\libOPENSSL-1.1.0\GCC64RT\include -Ic:\libQT-5.11-dev\build\qtbase\mkspecs\win32-g++  -o openssl.o c:\libQT-5.11-dev\build\qtbase\config.tests\openssl\openssl.cpp
      > g++ -Wl,-s -Wl,-subsystem,console -static -mthreads -o openssl.exe openssl.o  -Lc:\libOPENSSL-1.1.0\GCC64RT\lib c:\libOPENSSL-1.1.0\GCC64RT\lib\libssl.a c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a
       => source accepted.
      test config.network.libraries.openssl succeeded
      Checking for OpenSSL v. 1.1 support...
      + cd /d c:\libQT-5.11-dev\build\config.tests\unix\openssl11 && c:\libQT-5.11-dev\build\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" "LIBS += -lws2_32" c:/libQT-5.11-dev/build/qtbase/config.tests/unix/openssl11
      + cd /d c:\libQT-5.11-dev\build\config.tests\unix\openssl11 && set MAKEFLAGS=& mingw32-make
      > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -Ic:\libQT-5.11-dev\build\qtbase\config.tests\unix\openssl11 -I. -Ic:\libQT-5.11-dev\build\qtbase\mkspecs\win32-g++  -o openssl.o c:\libQT-5.11-dev\build\qtbase\config.tests\unix\openssl11\openssl.cpp
      > g++ -Wl,-s -Wl,-subsystem,console -static -mthreads -o openssl.exe openssl.o  -lws2_32
      test config.network.tests.openssl11 succeeded
      
      <snip>
      
      Qt Network:
        getifaddrs() ........................... no
        IPv6 ifname ............................ no
        libproxy ............................... no
        OpenSSL ................................ yes
          Qt directly linked to OpenSSL ........ yes
        SCTP ................................... no
        Use system proxies ..................... yes
      
      <snip>
      
      mingw32-make[5]: Entering directory 'c:/libQT-5.11-dev/build/qtbase/examples/network/download'
      g++ -Wl,-s -Wl,-subsystem,console -static -o release\download.exe .obj/release/main.o .obj/release/download_plugin_import.o  -Lc:\libQT-5.11-dev\build\qtbase\plugins\bearer c:\libQT-5.11-dev\build\qtbase\plugins\bearer\libqgenericbearer.a -Lc:\libQT-5.11-dev\build\qtbase\lib -Lc:\libOPENSSL-1.1.0\GCC64RT\lib c:\libQT-5.11-dev\build\qtbase\plugins\bearer\libqnativewifibearer.a c:\libQT-5.11-dev\build\qtbase\lib\libQt5Network.a -ldnsapi -liphlpapi -lcrypt32 c:\libOPENSSL-1.1.0\GCC64RT\lib\libssl.a c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a -lgdi32 -lwsock32 c:\libQT-5.11-dev\build\qtbase\lib\libQt5Core.a -lmpr -lnetapi32 -luserenv -lversion -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lwinmm -lz c:\libQT-5.11-dev\build\qtbase\lib\libqtpcre2.a
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0xacd): undefined reference to `__imp_CertGetCertificateContextProperty'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x1f65): undefined reference to `__imp_CertOpenStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x1f88): undefined reference to `__imp_CertEnumCertificatesInStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x203d): undefined reference to `__imp_CertGetCertificateContextProperty'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x207b): undefined reference to `__imp_CertGetCertificateContextProperty'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x20c9): undefined reference to `__imp_CertDuplicateCertificateContext'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x2107): undefined reference to `__imp_CertCloseStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x32c1): undefined reference to `__imp_CertOpenStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x32ee): undefined reference to `__imp_CertEnumCertificatesInStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x3353): undefined reference to `__imp_CertEnumCertificatesInStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x345a): undefined reference to `__imp_CertCloseStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x3486): undefined reference to `__imp_CertGetCertificateContextProperty'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x34c4): undefined reference to `__imp_CertGetCertificateContextProperty'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x3741): undefined reference to `__imp_CertFindCertificateInStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x3886): undefined reference to `__imp_CertGetCertificateContextProperty'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x4166): undefined reference to `__imp_CertOpenStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x419d): undefined reference to `__imp_CertEnumCertificatesInStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x41ce): undefined reference to `__imp_CertGetCertificateContextProperty'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x42fa): undefined reference to `__imp_CertCloseStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x4328): undefined reference to `__imp_CertFindCertificateInStore'
      c:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(e_capi.o):e_capi.c:(.text+0x433b): undefined reference to `__imp_CertGetCertificateContextProperty'
      collect2.exe: error: ld returned 1 exit status
      mingw32-make[5]: *** [Makefile.Release:64: release\download.exe] Error 1
      mingw32-make[5]: Leaving directory 'c:/libQT-5.11-dev/build/qtbase/examples/network/download'
      mingw32-make[4]: *** [Makefile:36: release] Error 2
      mingw32-make[4]: Leaving directory 'c:/libQT-5.11-dev/build/qtbase/examples/network/download'
      mingw32-make[3]: *** [Makefile:58: sub-download-make_first] Error 2
      mingw32-make[3]: Leaving directory 'c:/libQT-5.11-dev/build/qtbase/examples/network'
      mingw32-make[2]: *** [Makefile:179: sub-network-make_first] Error 2
      mingw32-make[2]: Leaving directory 'c:/libQT-5.11-dev/build/qtbase/examples'
      mingw32-make[1]: *** [Makefile:70: sub-examples-make_first] Error 2
      mingw32-make[1]: Leaving directory 'c:/libQT-5.11-dev/build/qtbase'
      mingw32-make: *** [Makefile:41: module-qtbase-make_first] Error 2
      

      and

      mingw32-make[1]: Entering directory 'c:/libQT-5.11-dev/build/qtbase/tests/auto/corelib/kernel/qsocketnotifier'
      g++ -Wl,-s -mthreads -static -Wl,-subsystem,console -o release\tst_qsocketnotifier.exe .obj/release/tst_qsocketnotifier.o .obj/release/tst_qsocketnotifier_plugin_import.o  -LC:\libQT-5.11-dev\build\qtbase\plugins\bearer C:\libQT-5.11-dev\build\qtbase\plugins\bearer\libqgenericbearer.a -LC:\libQT-5.11-dev\build\qtbase\lib -LC:\libICU-61.1-dev\GCC64RT\lib -LC:\libOPENSSL-1.1.0\GCC64RT\lib C:\libQT-5.11-dev\build\qtbase\lib\libQt5Network.a -ldnsapi -liphlpapi C:\libQT-5.11-dev\build\qtbase\lib\libQt5Test.a C:\libQT-5.11-dev\build\qtbase\lib\libQt5Core.a -lmpr -lnetapi32 -luserenv -lversion -lws2_32 -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lwinmm -lz -lsicuin -lsicuuc -lsicudt C:\libQT-5.11-dev\build\qtbase\lib\libqtpcre2.a C:\libOPENSSL-1.1.0\GCC64RT\lib\libssl.a C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a -lcrypt32
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(b_addr.o):b_addr.c:(.text+0xd6): undefined reference to `__imp_ntohs'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(b_addr.o):b_addr.c:(.text+0x1f9): undefined reference to `gai_strerrorW'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(b_addr.o):b_addr.c:(.text+0xb70): undefined reference to `gai_strerrorW'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(b_sock.o):b_sock.c:(.text+0x14a): undefined reference to `__imp_ioctlsocket'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(b_sock.o):b_sock.c:(.text+0x1e8): undefined reference to `__imp_ioctlsocket'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x1af): undefined reference to `__imp_WSASetLastError'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x1c2): undefined reference to `__imp_send'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x265): undefined reference to `__imp_WSASetLastError'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x27a): undefined reference to `__imp_send'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x31e): undefined reference to `__imp_WSASetLastError'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x335): undefined reference to `__imp_recv'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x27): undefined reference to `__imp_socket'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x202): undefined reference to `__imp_connect'
      C:\libOPENSSL-1.1.0\GCC64RT\lib\libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x675): undefined reference to `__imp_accept'
      collect2.exe: error: ld returned 1 exit status
      mingw32-make[1]: *** [Makefile.Release:64: release\tst_qsocketnotifier.exe] Error 1
      mingw32-make[1]: Leaving directory 'c:/libQT-5.11-dev/build/qtbase/tests/auto/corelib/kernel/qsocketnotifier'
      mingw32-make: *** [Makefile:36: release] Error 2
      

      Reproduced for:

      • static Qt5-dev builds with no-shared OpenSSL-1.1.x using mingw-w64,

      not reproduced for:

      • static Qt5-dev builds with shared OpenSSL-1.1.x using mingw-w64,
      • static Qt5-dev builds with no-shared OpenSSL-1.1.x using ICC on Windows and MSVC.

       

      Use

      OPENSSL_LIBS="-llibssl -llibcrypto -lcrypt32 -lws2_32"

      flags instead of

      OPENSSL_LIBS="-llibssl -llibcrypto"

      fixes this issue.

       

      This issue is similar to QTBUG-32448 and expected to be fixed in the same way.

       

       

      Best,

      Alexander

       

      Attachments

        Issue Links

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

          Activity

            People

              jbornema Joerg Bornemann
              sav sav
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes