Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt 5.6.2 on Windows, static build with openssl 1.0.2L and MinGW492_32
Forum Updated to NodeBB v4.3 + New Features

Qt 5.6.2 on Windows, static build with openssl 1.0.2L and MinGW492_32

Scheduled Pinned Locked Moved Solved Installation and Deployment
14 Posts 2 Posters 7.1k Views 1 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.
  • M Offline
    M Offline
    Matthieu 0
    wrote on last edited by Matthieu 0
    #1

    Hi,

    I've successfully build a static version of Qt 5.6.2 with the script windows-build-qt-static.ps1 from this URL : http://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW
    I added some build options to disable some Qt modules I don't need.

    cmd /c "configure.bat -static -debug-and-release -platform win32-g++ -target xp -no-directwrite -prefix $QtDir -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -no-opengl -no-openvg -no-angle -qt-sql-sqlite -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -skip qtwebengine -skip qtwebview -skip qtquickcontrols -skip qtquickcontrols2 -skip qtlocation -skip qtscript"
    

    I get this message but it seems to work on Windows XP. Is it normal with MinGW?

    WARNING: Cannot use Windows Kit 8 to build Qt for Windows XP. 
    WARNING: Windows SDK v7.1A is recommended.
    

    I am able to build a static application, only one executable file. It works well.

    Now, my application need to download files from https.
    So, I need to add the openssl support to my static build of Qt so that my application doesn't need to be released with an openssl dll.
    I downloaded and installed the precompiled openssl version 1.0.2L from this URL : https://slproweb.com/products/Win32OpenSSL.html
    I added these options to the script windows-build-qt-static.ps1 :

    -openssl -I c:\OpenSSL-Win32\include -L c:\OpenSSL-Win32\lib\MinGW
    

    The build of Qt seems to complete without any error.
    I build my application.
    I run it, and I get an error saying it depends on Qt5Core.dll.

    Is there something bad with the openssl options I added to build Qt?

    Best regards,
    Matthieu

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

      Hi and welcome to devnet,

      Did you properly re-build Qt from scratch after adding OpenSSL to the mix ?

      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
        Matthieu 0
        wrote on last edited by
        #3

        Thanks :)
        Yes, I deleted the source directory and extracted the source archive again, so the configure was run from a clean state.

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

          Do you have several version of Qt installed in parallel ?

          If so, check the Kit you are using, it might be using the wrong version of Qt.

          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
            Matthieu 0
            wrote on last edited by
            #5

            hi,
            I have only one version installed.
            I realized that I didn't use the right Qt prompt, I was in dynamic environment.
            But, I still have problems in static environment.
            Do I need to link to -lssl, -lcrypto -llibeay32 -lssleay32, in the OPENSSL_LIBS ??

            I don't really understand the difference between -openssl and -openssl-linked.
            Is it possible to link statically openssl when I build my project instead of link to the Qt build?
            Best regards,

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Matthieu 0
              wrote on last edited by
              #6

              When I execute in debug mode my application, I get this error :

              qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_client_callback
              qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
              qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
              qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
              qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
              qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
              qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
              qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
              Auto configuration failed
              5672:error:02001015:system library:fopen:Is a directory:.\crypto\bio\bss_file.c:126:fopen('d:/test/openssl098kvc6/openssl.cnf','rb')
              5672:error:2006D002:BIO routines:BIO_new_file:system lib:.\crypto\bio\bss_file.c:131:
              5672:error:0E078002:configuration file routines:DEF_LOAD:system lib:.\crypto\conf\conf_def.c:199:
              QMutex: destroying locked mutex
              

              What I need to do to fix this, please?

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

                It looks like you didn't explicitly state that you wanted OpenSSL to be linked to Qt (-openssl-linked) so it tries to load the library but it can't find it. One way to check that is to go the Run part of the Project panel and modify the PATH environment variable there to include the path to the OpenSSL .dlls.

                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
                  Matthieu 0
                  wrote on last edited by Matthieu 0
                  #8

                  So I need to build with -openssl-linked.
                  But do I need to add some build options? like -lssl -lcrypto -lssleay -llibeay32?

                  In dependency walker, there is no openssl dll.

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

                    Because by default Qt loads the .dll it doesn't link against it.

                    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
                    • M Offline
                      M Offline
                      Matthieu 0
                      wrote on last edited by
                      #10

                      Is it possible to build qt without openssl dll dependencies?
                      I don't know if I am on the wrong way.

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

                        Yes, use -openssl-linked and a static build of 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
                        • M Offline
                          M Offline
                          Matthieu 0
                          wrote on last edited by Matthieu 0
                          #12

                          Hello,
                          To answer myself, I found the solution and here is how I did it.

                          First, I build openssl in static mode. You need to install active perl, mingw-get-setup.exe and mysys-1.0.11.exe (i'm not sure if this one is really required). I downloaded the openssl-1.0.2l sources and I followed this guide: http://www.stringcat.com/company_blog/2015/12/07/compiling-openssl-on-windows-mingw32/
                          To build, start mingw, go to the openssl root directory and run:

                          perl Configure mingw no-shared
                          

                          At the end, I created a subdirectory named lib in the openssl dir and copied libssl.a and libcrypo.a into it.

                          To build Qt, I used this script:
                          https://sourceforge.net/p/qtlmovie/code/ci/v1.2.16/tree/build/windows-build-qt-static.ps1?format=raw
                          I added these parameters to the configure line:

                          -openssl-linked -I c:\openssl\include -L c:\openssl\lib
                          

                          In this script, I added a pause between configure and make to be able to modify a file juste before the compilation phase. Just write a new line below configure and write: pause.

                          Execute the script.

                          When the script is paused, open the qtbase/mkspecs/qmodule.pri file and change:

                          -lssleay32 -llibeay32
                          

                          to:

                          -lssl -lcrypto -lgdi32
                          

                          and save the file.

                          Press any key to continue the pause. Wait, enjoy.

                          I think this is a bug in the Qt build system, with openssl-linked we shouldn't have linked to *eay32...

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

                            IIRC, it's Windows VS *nix naming issue with OpenSSL so not a bug.

                            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
                              Matthieu 0
                              wrote on last edited by
                              #14

                              So, it's a bug, for me :D

                              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