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. Official guide for compiling static QT with SSL support (possibly using OpenSSL toolkit already included in QT)
Forum Updated to NodeBB v4.3 + New Features

Official guide for compiling static QT with SSL support (possibly using OpenSSL toolkit already included in QT)

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 5 Posters 3.6k 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.
  • G Offline
    G Offline
    Giovanni R
    wrote on last edited by Giovanni R
    #5

    compiling with

    cmd /c "configure.bat -v -static -opensource -confirm-license -debug-and-release -platform win32-g++ -prefix $QtDir -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -openssl -I "C:\Qt\Tools\OpenSSL\src\include" -L "C:\Qt\Tools\OpenSSL\Win_x64\lib" OPENSSL_LIBS="-llibssl -llibcrypto" -make libs -nomake tools -nomake examples -nomake tests "

    so, using the "embedded" openssl frameworks, still gives me
    "ERROR: Feature 'openssl-runtime' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl_headers' failed." without any other explanation even if i'm running config in verbose mode.

    I'l like to know what's missing, if it cannot finds the path or anything, but -v doesn't gives me hints

    same if i compile using -openssl-linked, it just says "ERROR: Feature 'openssl-linked' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl' failed."

    i want to have a ssl static build that i compile with, so i get just one .exe and everything inside

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

      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

      G 1 Reply Last reply
      1
      • G Giovanni R

        compiling with

        cmd /c "configure.bat -v -static -opensource -confirm-license -debug-and-release -platform win32-g++ -prefix $QtDir -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -openssl -I "C:\Qt\Tools\OpenSSL\src\include" -L "C:\Qt\Tools\OpenSSL\Win_x64\lib" OPENSSL_LIBS="-llibssl -llibcrypto" -make libs -nomake tools -nomake examples -nomake tests "

        so, using the "embedded" openssl frameworks, still gives me
        "ERROR: Feature 'openssl-runtime' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl_headers' failed." without any other explanation even if i'm running config in verbose mode.

        I'l like to know what's missing, if it cannot finds the path or anything, but -v doesn't gives me hints

        same if i compile using -openssl-linked, it just says "ERROR: Feature 'openssl-linked' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl' failed."

        i want to have a ssl static build that i compile with, so i get just one .exe and everything inside

        artwawA Offline
        artwawA Offline
        artwaw
        wrote on last edited by
        #7

        @Giovanni-R try downloading ssl binaries precompiled with mingw or compile them from sources, those provided by Qt are compiled with MSVC. I don't say this is exactly the reason but I would definitely try.

        For more information please re-read.

        Kind Regards,
        Artur

        G 1 Reply Last reply
        0
        • artwawA artwaw

          @Giovanni-R try downloading ssl binaries precompiled with mingw or compile them from sources, those provided by Qt are compiled with MSVC. I don't say this is exactly the reason but I would definitely try.

          G Offline
          G Offline
          Giovanni R
          wrote on last edited by
          #8

          @artwaw hi! any hint on where i could find precompiled mingw builds?

          i would happily avoid compiling also OpenSSL but if it's needed i will...

          artwawA 1 Reply Last reply
          0
          • G Giovanni R

            @artwaw hi! any hint on where i could find precompiled mingw builds?

            i would happily avoid compiling also OpenSSL but if it's needed i will...

            artwawA Offline
            artwawA Offline
            artwaw
            wrote on last edited by artwaw
            #9

            @Giovanni-R I had, some time ago, an issue where my software was working on some machines and on some machines not (login to external service was failing). It was very frustrating as all libs were in place and on some it was indeed working... I finally did my due diligence and found out, that some of the machines had vcredist libs and those were working fine, some others had not and those were failing. Then I checked the Qt libraries and the truth came out.

            When you go to the https://wiki.openssl.org you'll undoubtedly find the list of mirrors. I needed 1.1.1.4 (1.1.1.d) then and I am not sure which ones you'll need (info about OpenSSL compatibility per version should be somewhere in docs as this is where I took it from). I used this site to obtain binaries: https://github.com/curl/curl-for-win#binary-package-downloads

            You will need curl, please take time to read how to obtain binaries in required version.

            Of course, you're most welcome to pursue any other source of binaries you find trustworthy, there is a few.

            For more information please re-read.

            Kind Regards,
            Artur

            1 Reply Last reply
            0
            • SGaistS SGaist

              Shouldn't that be -lssl -lcrypto ?

              G Offline
              G Offline
              Giovanni R
              wrote on last edited by
              #10

              @SGaist did i already say i am lost? :)

              i will try with -lssl -lcrypto
              tried, no luck, same error

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

                There are test logs generated, you should be able to find there the exact error regarding OpenSSL.

                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
                • G Offline
                  G Offline
                  Giovanni R
                  wrote on last edited by Giovanni R
                  #12
                  Trying source 0 (type inline) of library openssl_headers ...
                  openssl/ssl.h not found in [] and global paths.
                  openssl/opensslv.h not found in [] and global paths.
                    => source produced no result.
                  test config.qtbase_network.libraries.openssl_headers FAILED
                  Trying source 0 (type makeSpec) of library network ...
                   => source accepted.
                  loaded result for config test config.qtbase_network.tests.getifaddrs
                  + cd /d C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\config.tests\getifaddrs && C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" "QMAKE_USE += network" "QMAKE_LIBS_NETWORK = -lws2_32" C:/Qt/Static5152/src/qt-everywhere-src-5.15.2/config.tests/getifaddrs
                  + cd /d C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\config.tests\getifaddrs && set MAKEFLAGS=& mingw32-make
                  > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_STATIC_BUILD -I. -IC:\Qt\Static5152\src\qt-everywhere-src-5.15.2\qtbase\mkspecs\win32-g++  -o main.o main.cpp
                  > main.cpp:3:10: fatal error: sys/socket.h: No such file or directory
                  >  #include <sys/socket.h>
                  >           ^~~~~~~~~~~~~~
                  

                  I want to focus on that part of the config.log... (it's taken from a powershell script so it has some escaping)

                  "openssl/ssl.h not found in [] and global paths.
                  openssl/opensslv.h not found in [] and global paths."

                  config line is

                  configure.bat -opensource -confirm-license -static -debug-and-release -platform win32-g++ -prefix $QtDir -openssl-linked  -I 'C:\Qt\Tools\OpenSSL\src\include\openssl' -L 'C:\Qt\Tools\OpenSSL\Win_x64\lib' OPENSSL_LIBS=`"-lssl -lcrypto`" -skip webengine -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-sqlite -make libs -nomake tools -nomake examples -nomake tests
                  

                  i tried with -I C:\Qt\Tools\OpenSSL\src\include also but same result and i can tell you for sure that in C:\Qt\Tools\OpenSSL\src\include\openssl there is both opensslv.h and ssl.h (ssl toolkit from qt installer).

                  So why the config is not able to find them?

                  And also...

                  main.cpp:3:10: fatal error: sys/socket.h: No such file or directory
                  #include <sys/socket.h>

                  i don't feel like that one is usual. Am i wrong?
                  I mean it's crazy to me that i have to be stopped 2wks by stuff like that :/

                  jsulmJ 1 Reply Last reply
                  0
                  • G Giovanni R
                    Trying source 0 (type inline) of library openssl_headers ...
                    openssl/ssl.h not found in [] and global paths.
                    openssl/opensslv.h not found in [] and global paths.
                      => source produced no result.
                    test config.qtbase_network.libraries.openssl_headers FAILED
                    Trying source 0 (type makeSpec) of library network ...
                     => source accepted.
                    loaded result for config test config.qtbase_network.tests.getifaddrs
                    + cd /d C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\config.tests\getifaddrs && C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" "QMAKE_USE += network" "QMAKE_LIBS_NETWORK = -lws2_32" C:/Qt/Static5152/src/qt-everywhere-src-5.15.2/config.tests/getifaddrs
                    + cd /d C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\config.tests\getifaddrs && set MAKEFLAGS=& mingw32-make
                    > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_STATIC_BUILD -I. -IC:\Qt\Static5152\src\qt-everywhere-src-5.15.2\qtbase\mkspecs\win32-g++  -o main.o main.cpp
                    > main.cpp:3:10: fatal error: sys/socket.h: No such file or directory
                    >  #include <sys/socket.h>
                    >           ^~~~~~~~~~~~~~
                    

                    I want to focus on that part of the config.log... (it's taken from a powershell script so it has some escaping)

                    "openssl/ssl.h not found in [] and global paths.
                    openssl/opensslv.h not found in [] and global paths."

                    config line is

                    configure.bat -opensource -confirm-license -static -debug-and-release -platform win32-g++ -prefix $QtDir -openssl-linked  -I 'C:\Qt\Tools\OpenSSL\src\include\openssl' -L 'C:\Qt\Tools\OpenSSL\Win_x64\lib' OPENSSL_LIBS=`"-lssl -lcrypto`" -skip webengine -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-sqlite -make libs -nomake tools -nomake examples -nomake tests
                    

                    i tried with -I C:\Qt\Tools\OpenSSL\src\include also but same result and i can tell you for sure that in C:\Qt\Tools\OpenSSL\src\include\openssl there is both opensslv.h and ssl.h (ssl toolkit from qt installer).

                    So why the config is not able to find them?

                    And also...

                    main.cpp:3:10: fatal error: sys/socket.h: No such file or directory
                    #include <sys/socket.h>

                    i don't feel like that one is usual. Am i wrong?
                    I mean it's crazy to me that i have to be stopped 2wks by stuff like that :/

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13

                    @Giovanni-R said in Official guide for compiling static QT with SSL support (possibly using OpenSSL toolkit already included in QT):

                    -I 'C:\Qt\Tools\OpenSSL\src\include\openssl'

                    Change to

                    -I 'C:\Qt\Tools\OpenSSL\src\include
                    

                    But keep in mind that you should always do a complete rebuild (without old build artefacts)!

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    1
                    • G Offline
                      G Offline
                      Giovanni R
                      wrote on last edited by Giovanni R
                      #14

                      @jsulm

                      Nuking the whole folder and starting again seems to have fixed the issue (or at least, it seems like now it finds the headers that were missing) but now it's not even starting to compile

                      "mingw32-make: *** No targets specified and no makefile found. Stop.
                      mingw32-make: *** No rule to make target 'install'."

                      https://pastebin.com/XbrWwffA
                      This is the config.log

                      It misses random stuff, that was not missing last time i compiled with the same configure...i don't know if that's just me or the whole thing is utterly unusable (maybe it's Windows..i don't know...but still...)

                      jsulmJ 1 Reply Last reply
                      0
                      • G Giovanni R

                        @jsulm

                        Nuking the whole folder and starting again seems to have fixed the issue (or at least, it seems like now it finds the headers that were missing) but now it's not even starting to compile

                        "mingw32-make: *** No targets specified and no makefile found. Stop.
                        mingw32-make: *** No rule to make target 'install'."

                        https://pastebin.com/XbrWwffA
                        This is the config.log

                        It misses random stuff, that was not missing last time i compiled with the same configure...i don't know if that's just me or the whole thing is utterly unusable (maybe it's Windows..i don't know...but still...)

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by jsulm
                        #15

                        @Giovanni-R Did you also run configure again?

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                          This should pass the config test (no need to add -I and -L for openssl, and need to clear the build folder before running configure again):

                          -openssl-linked OPENSSL_PREFIX="C:\Qt\Tools\OpenSSL\Win_x64" OPENSSL_LIBS="-llibssl -llibcrypto"
                          
                          1 Reply Last reply
                          2
                          • jsulmJ jsulm

                            @Giovanni-R Did you also run configure again?

                            G Offline
                            G Offline
                            Giovanni R
                            wrote on last edited by
                            #17

                            @jsulm yes, everything cleaned up

                            and

                            @Bonnie i'll test and let you know!

                            1 Reply Last reply
                            0
                            • G Offline
                              G Offline
                              Giovanni R
                              wrote on last edited by
                              #18

                              @Bonnie finger crossed, QSslSocket::supportsSsl(); using the build compiled with OPENSSL_PREFIX seems to return true, so i'm pretty optimistic about the thing that it should work properly!

                              I don't know if i'm finally out of that nightmare but a huge THANKS in any case

                              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