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. OpenSource build of Qt5.15 with OpenSSL 1.1.1g statically linked - precondition libs.openssl failed
QtWS25 Last Chance

OpenSource build of Qt5.15 with OpenSSL 1.1.1g statically linked - precondition libs.openssl failed

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 3.9k Views
  • 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.
  • R Offline
    R Offline
    Robert_C
    wrote on last edited by
    #1

    I am returning to a code base that had been developed 6-7 years ago and am tasked with moving it to "current" tools and versions (joy!).

    The original code used a build of Qt 5.4 with OpenSSL 1.0.2d statically linked.

    I downloaded the source for OpenSSL 1.1.1g and built the win32 release target.

    Then I downloaded the zip file of the Qt5.15 files from https://download.qt.io/archive/qt/5.15/5.15.0/single and unzipped it to do the build. I am using a Windows 10 machine with Visual Studio 2019.

    Based on the old "config" arguments that we used when building Qt 5.4, I am trying to use similar arguments for the Qt 5.15 build:

    configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release -openssl-linked OPENSSL_LIBS="-llibcrypto -llibssl" -I C:\SSLBuild\Lib\x32\Release\include -L C:\SSLBuild\Lib\x32\Release\lib

    When I try to run this, I get the following error: ERROR:: Feature 'openssl-linked' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl' failed.

    Google searches have led me to various attempts to tweak the format in which the OpenSSL header file and library paths are specified, but I always get the same results. (I also learned to delete the config.cache file!!!)

    The contents of the config.log have not been useful to me in attempting to determine the issue.

    Any help/guidance would be appreciated. Seems like this "should" be do-able.

    Thanks,

    Bob

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #10

      Quoted from qtbase\src\network\ssl\ssl.pri

         # Add optional SSL libs
         # Static linking of OpenSSL with msvc:
         #   - Binaries http://slproweb.com/products/Win32OpenSSL.html
         #   - also needs -lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32
         #   - libs in <OPENSSL_DIR>\lib\VC\static
         #   - configure: -openssl-linked -openssl-linked OPENSSL_INCDIR="%OPENSSL_DIR%\include" OPENSSL_LIBDIR="%OPENSSL_DIR%\lib\VC\static" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32"  OPENSSL_LIBS_DEBUG="-llibssl64MDd -llibcrypto64MDd" OPENSSL_LIBS_RELEASE="-llibssl64MD -llibcrypto64MD"
      
      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to devnet,
        @Robert_C said in OpenSource build of Qt5.15 with OpenSSL 1.1.1g statically linked - precondition libs.openssl failed:

        OPENSSL_LIBS="-llibcrypto -llibssl"

        Shouldn't that be "-lssl -lcrypto" ?

        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
        • R Offline
          R Offline
          Robert_C
          wrote on last edited by
          #3

          The libs created when building OpenSSL 1.1.1g were libcrypto.lib and libssl.lib. This is not a universe I normally play in. Perhaps the library names changed recently? They DEFINITELY changed completely from the days of 1.0.2d!

          ;-)

          Bob

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

            When passing a library to the linker you drop the lib prefix.

            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
            • R Offline
              R Offline
              Robert_C
              wrote on last edited by
              #5

              Will give it a try later today and post my results. I have never seen the name of a library being used by Visual Studio modified. Thanks for the suggestion and I'll be back with the results.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Robert_C
                wrote on last edited by
                #6

                No change. Used the following arguments and got the same result:

                configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release -openssl-linked OPENSSL_LIBS="-lssl -lcrypto" -I C:\SSLBuild\Lib\x32\Release\include -L C:\SSLBuild\Lib\x32\Release\lib

                Is there a way to upload my config.log?

                There must be folks that do this using Windows 10 and Visual Studio 2019:

                1. Download OpenSSL 1.1.1g and build the Win32 release target

                2. Download Qt5.15 source and build statically linked to the OpenSSL libraries.

                Thank you very much for your ongoing assistance attempts.

                Bob

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  Robert_C
                  wrote on last edited by
                  #7

                  Rolled my sleeves up on that last attempt and worked on analyzing the config.log. It looks like the entries relevant to the "failure" are the following:

                  test config.qtbase_corelib.tests.atomicfptr succeeded <--- Last line in file from "previous" test
                  looking for library openssl
                  Trying source 0 (type openssl) of library openssl ...
                  $OPENSSL_LIBS is not set.
                  => source produced no result.

                  Bob

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Robert_C
                    wrote on last edited by
                    #8

                    From Qt bug reports like:

                    https://bugreports.qt.io/browse/QTBUG-65501
                    https://bugreports.qt.io/browse/QTBUG-62733

                    It looks like using the full OpenSSL library names, including the "lib" prefix is normal.

                    Bob

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Robert_C
                      wrote on last edited by
                      #9

                      Found examples on the internet that seem to show the lib path and the libs being both specified in the OPENSSL_LIBS value. So, I tried both of the following 'configure' argument sets, one with the "lib" prefix and one without.

                      There was no change in behavior.

                      configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release OPENSSL_LIBS="-LC:\SSLBuild\Lib\x32\Release\lib -lssl -lcrypto" -openssl-linked -I C:\SSLBuild\Lib\x32\Release\include

                      configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release OPENSSL_LIBS="-LC:\SSLBuild\Lib\x32\Release\lib -llibssl -llibcrypto" -openssl-linked -I C:\SSLBuild\Lib\x32\Release\include

                      Bob

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        Bonnie
                        wrote on last edited by Bonnie
                        #10

                        Quoted from qtbase\src\network\ssl\ssl.pri

                           # Add optional SSL libs
                           # Static linking of OpenSSL with msvc:
                           #   - Binaries http://slproweb.com/products/Win32OpenSSL.html
                           #   - also needs -lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32
                           #   - libs in <OPENSSL_DIR>\lib\VC\static
                           #   - configure: -openssl-linked -openssl-linked OPENSSL_INCDIR="%OPENSSL_DIR%\include" OPENSSL_LIBDIR="%OPENSSL_DIR%\lib\VC\static" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32"  OPENSSL_LIBS_DEBUG="-llibssl64MDd -llibcrypto64MDd" OPENSSL_LIBS_RELEASE="-llibssl64MD -llibcrypto64MD"
                        
                        1 Reply Last reply
                        1
                        • R Offline
                          R Offline
                          Robert_C
                          wrote on last edited by
                          #11

                          Thank you Bonnie! That information was invaluable. Based on what you shared, I used the following configure command:

                          configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release -openssl-linked OPENSSL_INCDIR="C:\SSLBuild\Lib\x32\Release\include" OPENSSL_LIBDIR="C:\SSLBuild\Lib\x32\Release\lib" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32" OPENSSL_LIBS_DEBUG="-llibssl -llibcrypto" OPENSSL_LIBS_RELEASE="-llibssl -llibcrypto"

                          This completed and I'm now ready to fire up nmake. (I may go back and build the debug OpenSSL libs, but for now I'm linking the release SSL libs into both the Qt Debug and Release builds.)

                          The nmake ought to take 2-3 minutes, right?

                          ;-)

                          Bob

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

                            @Robert_C said in OpenSource build of Qt5.15 with OpenSSL 1.1.1g statically linked - precondition libs.openssl failed:

                            The nmake ought to take 2-3 minutes, right?

                            Use jom, it will parallelise your build, nmake is sequential.

                            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

                            • Login

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