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. openSSL in QT
Forum Updated to NodeBB v4.3 + New Features

openSSL in QT

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 6.8k 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 24 Aug 2020, 19:11 last edited by
    #8

    Did you check that you have everything from the right architecture ?

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

    S 1 Reply Last reply 24 Aug 2020, 19:31
    1
    • S SGaist
      24 Aug 2020, 19:11

      Did you check that you have everything from the right architecture ?

      S Offline
      S Offline
      saeid0034
      wrote on 24 Aug 2020, 19:31 last edited by
      #9

      @SGaist yes, i build openssl by qt mingw

      1 Reply Last reply
      0
      • S Offline
        S Offline
        saeid0034
        wrote on 24 Aug 2020, 19:38 last edited by
        #10

        when i check ssl version of qt with QSslSocket::sslLibraryBuildVersionString() it say "OpenSSL 1.1.1d 10 Sep 2019"
        its mean i need to build version 1.1.1d?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          saeid0034
          wrote on 24 Aug 2020, 20:11 last edited by saeid0034
          #11

          i build openssl version 1.1.1d too
          and add lib to my project
          but still no luck
          here my code and error
          2ac46222-1eee-42a2-a011-3421031a792c-image.png

          and also openssl part in pro file

          win32: LIBS += -LD:/build/ver-1d-openssl/lib/ -lcrypto
          win32: LIBS += -LD:/build/ver-1d-openssl/lib/ -lssl
          
          INCLUDEPATH += D:/build/ver-1d-openssl/include
          DEPENDPATH += D:/build/ver-1d-openssl/include
          

          edit: when i add openssl dll in debug folder of my project its work just fine
          but i need static

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 24 Aug 2020, 20:27 last edited by
            #12

            Your application does not link to OpenSSL nor does Qt by default.

            As for when running your application, the dlls must be findable. The usual way is to copy the files in the same folder as your application or modify the PATH environment variable in the Run part of the Project panel.

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

            S 1 Reply Last reply 24 Aug 2020, 20:57
            3
            • S SGaist
              24 Aug 2020, 20:27

              Your application does not link to OpenSSL nor does Qt by default.

              As for when running your application, the dlls must be findable. The usual way is to copy the files in the same folder as your application or modify the PATH environment variable in the Run part of the Project panel.

              S Offline
              S Offline
              saeid0034
              wrote on 24 Aug 2020, 20:57 last edited by
              #13

              @SGaist yes by adding dll in exe folder im able to post data
              but there is anyway to include openssl static?

              J 1 Reply Last reply 25 Aug 2020, 04:40
              0
              • S saeid0034
                24 Aug 2020, 20:57

                @SGaist yes by adding dll in exe folder im able to post data
                but there is anyway to include openssl static?

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 25 Aug 2020, 04:40 last edited by
                #14

                @saeid0034 said in openSSL in QT:

                but there is anyway to include openssl static?

                Not without building Qt by yourself as normal Qt builds load OpenSSL libs at runtime.

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

                S 1 Reply Last reply 25 Aug 2020, 11:35
                4
                • J jsulm
                  25 Aug 2020, 04:40

                  @saeid0034 said in openSSL in QT:

                  but there is anyway to include openssl static?

                  Not without building Qt by yourself as normal Qt builds load OpenSSL libs at runtime.

                  S Offline
                  S Offline
                  saeid0034
                  wrote on 25 Aug 2020, 11:35 last edited by saeid0034
                  #15

                  @jsulm can anyone tell me i need to pass what in ./configure to build qt with openssl statically
                  i use this for build qt static for now

                  configure -opensource -confirm-license -static -platform win32-g++ -optimize-size -opengl desktop -prefix "C:\Qt\static" -skip webengine -nomake tests -nomake examples -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-tiff

                  i need to add what to build qt static + openssl?

                  edit: i see this page in wiki
                  based of this page i need to build qt like this

                  OPENSSL_LIBS='-L/d/build/ssl/lib -lssl -lcrypto' && configure -opensource -confirm-license -static -platform win32-g++ -openssl-linked -optimize-size -opengl desktop -prefix "C:\Qt\static" -skip webengine -nomake tests -nomake examples -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-tiff

                  in this configure OPENSSL_LIBS is Location of openssl-1.1.1g i compiled before (with mingw)

                  its all ok?

                  J 1 Reply Last reply 25 Aug 2020, 11:46
                  0
                  • S saeid0034
                    25 Aug 2020, 11:35

                    @jsulm can anyone tell me i need to pass what in ./configure to build qt with openssl statically
                    i use this for build qt static for now

                    configure -opensource -confirm-license -static -platform win32-g++ -optimize-size -opengl desktop -prefix "C:\Qt\static" -skip webengine -nomake tests -nomake examples -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-tiff

                    i need to add what to build qt static + openssl?

                    edit: i see this page in wiki
                    based of this page i need to build qt like this

                    OPENSSL_LIBS='-L/d/build/ssl/lib -lssl -lcrypto' && configure -opensource -confirm-license -static -platform win32-g++ -openssl-linked -optimize-size -opengl desktop -prefix "C:\Qt\static" -skip webengine -nomake tests -nomake examples -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-tiff

                    in this configure OPENSSL_LIBS is Location of openssl-1.1.1g i compiled before (with mingw)

                    its all ok?

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 25 Aug 2020, 11:46 last edited by
                    #16

                    @saeid0034 said in openSSL in QT:

                    OPENSSL_LIBS='-L/d/build/ssl/lib -lssl -lcrypto

                    This looks like linking against shared OpenSSL libs.

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

                    S 1 Reply Last reply 25 Aug 2020, 11:48
                    1
                    • J jsulm
                      25 Aug 2020, 11:46

                      @saeid0034 said in openSSL in QT:

                      OPENSSL_LIBS='-L/d/build/ssl/lib -lssl -lcrypto

                      This looks like linking against shared OpenSSL libs.

                      S Offline
                      S Offline
                      saeid0034
                      wrote on 25 Aug 2020, 11:48 last edited by saeid0034
                      #17

                      @jsulm you say i do not need to set OPENSSL_LIBS?
                      and by the way i think this 2 lib use for shared version libssl.dll.a & libcrypto.dll.a

                      and also i use mingw to build openssl and Qt

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Markus43
                        wrote on 25 Aug 2020, 13:28 last edited by
                        #18

                        You don't need to rebuild Qt. Just select OpenSSL in the installer, and do what is suggested here:

                        https://stackoverflow.com/questions/59507538/install-openssl-for-msvc2017-on-64-bit-windows-10

                        S 1 Reply Last reply 25 Aug 2020, 21:39
                        1
                        • M Markus43
                          25 Aug 2020, 13:28

                          You don't need to rebuild Qt. Just select OpenSSL in the installer, and do what is suggested here:

                          https://stackoverflow.com/questions/59507538/install-openssl-for-msvc2017-on-64-bit-windows-10

                          S Offline
                          S Offline
                          saeid0034
                          wrote on 25 Aug 2020, 21:39 last edited by
                          #19

                          @Markus43 thanks for reply, but i need openssl for static build

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            Markus43
                            wrote on 26 Aug 2020, 04:27 last edited by
                            #20

                            Then the question is: Does OpenSSL need to be static, too?

                            If you can live with using OpenSSL dlls while using static Qt, you can just add the following to your configure line (also with OpenSSL from the installer) and you're done.
                            e.g. for x86 builds:

                            -openssl -I C:\Qt\Tools\OpenSSL\Win_x86\include -L C:\Qt\Tools\OpenSSL\Win_x86\lib
                            
                            S 1 Reply Last reply 26 Aug 2020, 11:18
                            1
                            • M Markus43
                              26 Aug 2020, 04:27

                              Then the question is: Does OpenSSL need to be static, too?

                              If you can live with using OpenSSL dlls while using static Qt, you can just add the following to your configure line (also with OpenSSL from the installer) and you're done.
                              e.g. for x86 builds:

                              -openssl -I C:\Qt\Tools\OpenSSL\Win_x86\include -L C:\Qt\Tools\OpenSSL\Win_x86\lib
                              
                              S Offline
                              S Offline
                              saeid0034
                              wrote on 26 Aug 2020, 11:18 last edited by
                              #21

                              @Markus43 said in openSSL in QT:

                              Then the question is: Does OpenSSL need to be static, too?

                              If you can live with using OpenSSL dlls while using static Qt, you can just add the following to your configure line (also with OpenSSL from the installer) and you're done.
                              e.g. for x86 builds:

                              -openssl -I C:\Qt\Tools\OpenSSL\Win_x86\include -L C:\Qt\Tools\OpenSSL\Win_x86\lib
                              

                              for using openssl static too i need to build Qt static with openssl again?

                              M 1 Reply Last reply 27 Aug 2020, 05:24
                              0
                              • S saeid0034
                                26 Aug 2020, 11:18

                                @Markus43 said in openSSL in QT:

                                Then the question is: Does OpenSSL need to be static, too?

                                If you can live with using OpenSSL dlls while using static Qt, you can just add the following to your configure line (also with OpenSSL from the installer) and you're done.
                                e.g. for x86 builds:

                                -openssl -I C:\Qt\Tools\OpenSSL\Win_x86\include -L C:\Qt\Tools\OpenSSL\Win_x86\lib
                                

                                for using openssl static too i need to build Qt static with openssl again?

                                M Offline
                                M Offline
                                Markus43
                                wrote on 27 Aug 2020, 05:24 last edited by
                                #22

                                @saeid0034 said in openSSL in QT:

                                for using openssl static too i need to build Qt static with openssl again?

                                Yes. Think about it: when linking against dlls, the linker only links the OpenSSL function calls in a way that they call the dll. When linking against static OpenSSL, the linker copies the called functions' code into the executable being built.

                                Anyhow, I never did a static build of OpenSSL, so I'm not sure if the line above works for static builds, too.

                                1 Reply Last reply
                                1

                                17/22

                                25 Aug 2020, 11:48

                                • Login

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