Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error while building qt 5.9 with openssl statically using VS2015
Forum Updated to NodeBB v4.3 + New Features

Error while building qt 5.9 with openssl statically using VS2015

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 6 Posters 4.5k Views 2 Watching
  • 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.
  • F flouwet

    I've got the build working with following patch.

    diff --git a/src/network/configure.json b/src/network/configure.json
    index 1e08aa7..c9077c8 100644
    --- a/src/network/configure.json
    +++ b/src/network/configure.json
    @@ -46,13 +46,24 @@
                     "-lproxy"
                 ]
             },
    -        "openssl_headers": {
    -            "label": "OpenSSL Headers",
    -            "export": "openssl",
    -            "test": "unix/openssl",
    -            "sources": [
    -                {
    -                    "comment": "placeholder for OPENSSL_PATH",
    -                    "libs": ""
    -                }
    -            ]
    -        },
             "openssl": {
    +            "label": "OpenSSL Libraries",
    +           "export": "",
    -            "label": "OpenSSL",
    -            "test": "unix/openssl",
                 "sources": [
                     { "type": "openssl" },
                     {
    +                    "comment": "placeholder for OPENSSL_LIBS{,_{DEBUG,RELEASE}}",
    -                    "comment": "placeholder for OPENSSL_{PATH,LIBS{,_{DEBUG,RELEASE}}}",
                         "libs": "",
                         "builds": {
                             "debug": "",
    @@ -92,11 +103,6 @@
                 "test": "unix/ipv6ifname",
                 "use": "network"
             },
    +        "openssl": {
    +           "label": "OpenSSL",
    +            "type": "compile",
    +           "test": "unix/openssl"
    +        },
             "sctp": {
                 "label": "SCTP support",
                 "type": "compile",
    @@ -138,7 +144,7 @@
                 "enable": "input.openssl == 'yes' || input.openssl == 'linked' || input.openssl == 'runtime'",
                 "disable": "input.openssl == 'no' || input.ssl == 'no'",
                 "autoDetect": "!config.winrt",
    +            "condition": "!features.securetransport && tests.openssl",
    -            "condition": "!features.securetransport && (features.openssl-linked || libs.openssl_headers)",
                 "output": [
                     "privateFeature",
                     { "type": "publicQtConfig", "condition": "!features.openssl-linked" },
    @@ -149,14 +155,9 @@
                 "label": "  Qt directly linked to OpenSSL",
                 "enable": "input.openssl == 'linked'",
                 "disable": "input.openssl != 'linked'",
    +            "condition": "features.openssl && libs.openssl",
    -            "condition": "!features.securetransport && libs.openssl",
                 "output": [
                     "privateFeature",
    +                { "type": "varAssign", "name": "OPENSSL_LIBS", "value": "libs.openssl.libs", "eval": "true" },
    +                { "type": "varAssign", "name": "OPENSSL_LIBS_DEBUG", "value": "libs.openssl.builds.debug.libs",
    +                  "eval": "true", "condition": "config.win32" },
    +                { "type": "varAssign", "name": "OPENSSL_LIBS_RELEASE", "value": "libs.openssl.builds.release.libs",
    +                  "eval": "true", "condition": "config.win32" },
                     { "type": "define", "name": "QT_LINKED_OPENSSL" }
                 ]
             },
    diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
    index 7935101..52ce2ee 100644
    --- a/src/network/ssl/ssl.pri
    +++ b/src/network/ssl/ssl.pri
    @@ -56,7 +56,7 @@ qtConfig(ssl) {
                        ssl/qsslellipticcurve_dummy.cpp
         }
     
    +    qtConfig(openssl)|qtConfig(openssl-linked) {
    -    qtConfig(openssl) {
             HEADERS += ssl/qsslcontext_openssl_p.h \
                        ssl/qsslsocket_openssl_p.h \
                        ssl/qsslsocket_openssl_symbols_p.h
    @@ -79,16 +79,10 @@ qtConfig(ssl) {
             #   - libs in <OPENSSL_DIR>\lib\VC\static
             #   - configure: -openssl -openssl-linked -I <OPENSSL_DIR>\include -L <OPENSSL_DIR>\lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD"
     
    +        include($$OUT_PWD/qtnetwork-config.pri)
    +
    +        CONFIG(debug, debug|release) {
    +            LIBS_PRIVATE += $$OPENSSL_LIBS_DEBUG
    +        } else {
    +            LIBS_PRIVATE += $$OPENSSL_LIBS_RELEASE
    +        }
    +
    +        QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS
    +        LIBS_PRIVATE += $$OPENSSL_LIBS
    -        qtConfig(openssl-linked): \
    -            QMAKE_USE_FOR_PRIVATE += openssl
    -        else: \
    -            QMAKE_USE_FOR_PRIVATE += openssl/nolink
             win32: LIBS_PRIVATE += -lcrypt32
         }
     }```
    M Offline
    M Offline
    mcpp
    wrote on last edited by
    #10

    @flouwet I'm getting error: corrupt patch at line 33 when I save this patch in notepad++ and apply using git

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #11

      @mcpp
      There are several patches here, which one didn't apply correctly ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mcpp
        wrote on last edited by
        #12

        @SGaist I copied the patch from the window. Here is what I brought to the editor. Its says corrupt patch at line 33. I assume I'm just doing something wrong. Any advice?

        diff --git a/src/network/configure.json b/src/network/configure.json
        index 1e08aa7..c9077c8 100644
        --- a/src/network/configure.json
        +++ b/src/network/configure.json
        @@ -46,13 +46,24 @@
        "-lproxy"
        ]
        },

        •    "openssl_headers": {
          
        •        "label": "OpenSSL Headers",
          
        •        "export": "openssl",
          
        •        "test": "unix/openssl",
          
        •        "sources": [
          
        •            {
          
        •                "comment": "placeholder for OPENSSL_PATH",
          
        •                "libs": ""
          
        •            }
          
        •        ]
          
        •    },
             "openssl": {
          
        •        "label": "OpenSSL Libraries",
          
        •       "export": "",
          
        •        "label": "OpenSSL",
          
        •        "test": "unix/openssl",
                 "sources": [
                     { "type": "openssl" },
                     {
          
        •                "comment": "placeholder for OPENSSL_LIBS{,_{DEBUG,RELEASE}}",
          
        •                "comment": "placeholder for OPENSSL_{PATH,LIBS{,_{DEBUG,RELEASE}}}",
                         "libs": "",
                         "builds": {
                             "debug": "",
          

        @@ -92,11 +103,6 @@
        "test": "unix/ipv6ifname",
        "use": "network"
        },

        •    "openssl": {
          
        •       "label": "OpenSSL",
          
        •        "type": "compile",
          
        •       "test": "unix/openssl"
          
        •    },
             "sctp": {
                 "label": "SCTP support",
                 "type": "compile",
          

        @@ -138,7 +144,7 @@
        "enable": "input.openssl == 'yes' || input.openssl == 'linked' || input.openssl == 'runtime'",
        "disable": "input.openssl == 'no' || input.ssl == 'no'",
        "autoDetect": "!config.winrt",

        •        "condition": "!features.securetransport && tests.openssl",
          
        •        "condition": "!features.securetransport && (features.openssl-linked || libs.openssl_headers)",
                 "output": [
                     "privateFeature",
                     { "type": "publicQtConfig", "condition": "!features.openssl-linked" },
          

        @@ -149,14 +155,9 @@
        "label": " Qt directly linked to OpenSSL",
        "enable": "input.openssl == 'linked'",
        "disable": "input.openssl != 'linked'",

        •        "condition": "features.openssl && libs.openssl",
          
        •        "condition": "!features.securetransport && libs.openssl",
                 "output": [
                     "privateFeature",
          
        •            { "type": "varAssign", "name": "OPENSSL_LIBS", "value": "libs.openssl.libs", "eval": "true" },
          
        •            { "type": "varAssign", "name": "OPENSSL_LIBS_DEBUG", "value": "libs.openssl.builds.debug.libs",
          
        •              "eval": "true", "condition": "config.win32" },
          
        •            { "type": "varAssign", "name": "OPENSSL_LIBS_RELEASE", "value": "libs.openssl.builds.release.libs",
          
        •              "eval": "true", "condition": "config.win32" },
                     { "type": "define", "name": "QT_LINKED_OPENSSL" }
                 ]
             },
          

        diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
        index 7935101..52ce2ee 100644
        --- a/src/network/ssl/ssl.pri
        +++ b/src/network/ssl/ssl.pri
        @@ -56,7 +56,7 @@ qtConfig(ssl) {
        ssl/qsslellipticcurve_dummy.cpp
        }

        • qtConfig(openssl)|qtConfig(openssl-linked) {
        • qtConfig(openssl) {
          HEADERS += ssl/qsslcontext_openssl_p.h
          ssl/qsslsocket_openssl_p.h
          ssl/qsslsocket_openssl_symbols_p.h
          @@ -79,16 +79,10 @@ qtConfig(ssl) {
          # - libs in <OPENSSL_DIR>\lib\VC\static
          # - configure: -openssl -openssl-linked -I <OPENSSL_DIR>\include -L <OPENSSL_DIR>\lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD"
        •    include($$OUT_PWD/qtnetwork-config.pri)
          
        •    CONFIG(debug, debug|release) {
          
        •        LIBS_PRIVATE += $$OPENSSL_LIBS_DEBUG
          
        •    } else {
          
        •        LIBS_PRIVATE += $$OPENSSL_LIBS_RELEASE
          
        •    }
          
        •    QMAKE_CXXFLAGS += $$OPENSSL_CFLAGS
          
        •    LIBS_PRIVATE += $$OPENSSL_LIBS
          
        •    qtConfig(openssl-linked): \
          
        •        QMAKE_USE_FOR_PRIVATE += openssl
          
        •    else: \
          
        •        QMAKE_USE_FOR_PRIVATE += openssl/nolink
             win32: LIBS_PRIVATE += -lcrypt32
          
          }
          }```
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #13

          You didn't do something wrong. The files the original patches were applied to changed in between.

          You can also simply compare the content of the files with the modifications and apply them by hand.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 2 Replies Last reply
          1
          • SGaistS SGaist

            You didn't do something wrong. The files the original patches were applied to changed in between.

            You can also simply compare the content of the files with the modifications and apply them by hand.

            M Offline
            M Offline
            mcpp
            wrote on last edited by
            #14

            @SGaist Okay I'll try that. Thanks for your help and amazing contribution to this source.

            1 Reply Last reply
            0
            • SGaistS SGaist

              You didn't do something wrong. The files the original patches were applied to changed in between.

              You can also simply compare the content of the files with the modifications and apply them by hand.

              M Offline
              M Offline
              mcpp
              wrote on last edited by
              #15

              @SGaist Okay It seems to be getting a bit further, however I am getting this error now:

              libeay32MT.lib(gost_eng.obj) : error LNK2019: unresolved external symbol __iob_func referenced in function bind_gost
              libeay32MT.lib(ui_openssl.obj) : error LNK2001: unresolved external symbol __iob_func
              ssleay32MT.lib(t1_enc.obj) : error LNK2001: unresolved external symbol __iob_func
              libeay32MT.lib(cryptlib.obj) : error LNK2001: unresolved external symbol __iob_func
              libeay32MT.lib(txt_db.obj) : error LNK2001: unresolved external symbol __iob_func
              libeay32MT.lib(e_capi.obj) : error LNK2001: unresolved external symbol __iob_func
              libeay32MT.lib(cryptlib.obj) : error LNK2019: unresolved external symbol sscanf referenced in function OPENSSL_cpuid_setup
              libeay32MT.lib(v3_utl.obj) : error LNK2001: unresolved external symbol sscanf
              libeay32MT.lib(cryptlib.obj) : error LNK2019: unresolved external symbol _vsnwprintf referenced in function OPENSSL_showfatal
              ....\bin\xmlpatterns.exe : fatal error LNK1120: 3 unresolved externals

              My config is:

              configure -static -debug-and-release -prefix “C:\Qt\Qt5.9.2\static_with_openssl” -platform win32-msvc2015 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-sqlite -sql-odbc -openssl-linked -I "C:\Program Files\OpenSSL-Win64\include" -L "C:\Program Files\OpenSSL-Win64\lib\VC\static" OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32 -lCrypt32" OPENSSL_LIBS_DEBUG="-lssleay32MTd -llibeay32MTd" OPENSSL_LIBS_RELEASE="-lssleay32MT -llibeay32MT" -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests

              Any ideas? I'm building with VS2015.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #16

                Might be a silly question but: are you sure you are building in 64 bit mode ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mcpp
                  wrote on last edited by
                  #17

                  I am. I think its a version compatibility issue with ssl. It should be built with vs2015. Even though those say 32MT, I think the problem is that they are built with vs2013. I built these with vs2015 and tried again, and got these:

                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol sk_num referenced in function "int __cdecl q_sk_num(struct stack_st *)" (?q_sk_num@@YAHPEAUstack_st@@@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol sk_value referenced in function "void * __cdecl q_sk_value(struct stack_st *,int)" (?q_sk_value@@YAPEAXPEAUstack_st@@H@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol sk_new_null referenced in function "struct stack_st * __cdecl q_sk_new_null(void)" (?q_sk_new_null@@YAPEAUstack_st@@XZ)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol sk_free referenced in function "void __cdecl q_sk_free(struct stack_st *)" (?q_sk_free@@YAXPEAUstack_st@@@Z)

                  And about 500 others.

                  What libs should I be building using vs2015 for openssl?

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #18

                    Well, OpenSSL itself.

                    You can't mix and match C++ libraries built with different compilers on Windows. The only exception currently is VS2017 which is backward compatible with VS2015.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • L Offline
                      L Offline
                      LSIDev
                      wrote on last edited by
                      #19

                      Had the same unresolved errors by using Visual2017, Qt5.9.8, having an own compiled static OpenSSL-libs, so this could not be the mentioned compatibility problem.
                      Lately I found out that the unresolved was not caused by linking the Qt5Network.lib, because this was already created on the disk. The lib that caused the error was the xmlpatters-lib, and when I removed it from compiling by using -skip xmlpatterns in the config command, everythign went fine!
                      So my final command was

                      C:\Qt\Qt5.9.8\5.9.8\Src\configure.bat -release -static -static-runtime -prefix C:\Qt\Qt5.9.8_static_ssl −opengl desktop -skip webengine -skip xmlpatterns -nomake tests -nomake examples -openssl -openssl-linked -I C:\OpenSSL\include -L C:\OpenSSL\lib
                      

                      by having the three environment variables OPENSSL_LIBS, OPENSSL_LIBS_DEBUG and OPENSSL_LIBS_RELEASE already set via windows system settings. Setting them directly in the command line caused syntax errors (probably only supported by earlier Configure-versions?)

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved