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. Qt static with OpenSSL issue

Qt static with OpenSSL issue

Scheduled Pinned Locked Moved Solved General and Desktop
24 Posts 4 Posters 5.3k 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.
  • C Cobra91151
    16 Oct 2018, 20:25

    @Bernard-Lowe

    Hi! What is your compiler? Try to attach the debugger to the application and check again. By the way, check my Qt static with MySQL issue here: https://forum.qt.io/topic/94378/qt-static-with-mysql-issue/33 to get more information about Qt static compilation.

    B Offline
    B Offline
    Bernard Lowe
    wrote on 16 Oct 2018, 23:18 last edited by Bernard Lowe
    #15

    @Cobra91151 Hello! Thanks for your comprehensive response. My compiler is VS 2017 (linked with OpenSSL v1.0.2l). I had a debugger attached (cdb.exe) through qtcreator which would detatch the debugger before the main entry point. I am on openssl 'l' so your post could be very relevant here so I'll explore after trying one more thing:
    One major oops that I had just realized was that I left in MD instead of MT after setting -static-runtime in configure so I am trying with MT now.

    C 1 Reply Last reply 17 Oct 2018, 06:46
    0
    • B Bernard Lowe
      16 Oct 2018, 23:18

      @Cobra91151 Hello! Thanks for your comprehensive response. My compiler is VS 2017 (linked with OpenSSL v1.0.2l). I had a debugger attached (cdb.exe) through qtcreator which would detatch the debugger before the main entry point. I am on openssl 'l' so your post could be very relevant here so I'll explore after trying one more thing:
      One major oops that I had just realized was that I left in MD instead of MT after setting -static-runtime in configure so I am trying with MT now.

      C Offline
      C Offline
      Cobra91151
      wrote on 17 Oct 2018, 06:46 last edited by Cobra91151
      #16

      @Bernard-Lowe

      Hi! Try compiling Qt with SSL /MT libs and reply. By the way, you can check if it work with Visual Studio before compiling Qt. By creating simple console project:

      Code:

      #include <iostream>
      #include <openssl/bio.h>
      #include <openssl/ssl.h>
      #include <openssl/err.h>
      using namespace std;
      
      int main()
      {
      	cout << "Hello World!" << endl;
      	SSL_load_error_strings();
      	ERR_load_BIO_strings();
      	OpenSSL_add_all_algorithms();
              system("Pause");
              return 0;
      }
      

      Don't forget to add all the OpenSSL includes/libs to VS 2017 and change Runtime library to Multi-threaded (/MT) (as Release) in Code Generation section.

      B 1 Reply Last reply 17 Oct 2018, 14:13
      1
      • C Cobra91151
        17 Oct 2018, 06:46

        @Bernard-Lowe

        Hi! Try compiling Qt with SSL /MT libs and reply. By the way, you can check if it work with Visual Studio before compiling Qt. By creating simple console project:

        Code:

        #include <iostream>
        #include <openssl/bio.h>
        #include <openssl/ssl.h>
        #include <openssl/err.h>
        using namespace std;
        
        int main()
        {
        	cout << "Hello World!" << endl;
        	SSL_load_error_strings();
        	ERR_load_BIO_strings();
        	OpenSSL_add_all_algorithms();
                system("Pause");
                return 0;
        }
        

        Don't forget to add all the OpenSSL includes/libs to VS 2017 and change Runtime library to Multi-threaded (/MT) (as Release) in Code Generation section.

        B Offline
        B Offline
        Bernard Lowe
        wrote on 17 Oct 2018, 14:13 last edited by
        #17

        @Cobra91151
        Your spike solution worked perfectly, it was also quite revealing because after succeeding using https://www.npcglib.org/~stathis/blog/precompiled-openssl/ MT libs with static runtime in Visual Studio, I attempted to use the MD libs and the linker attempted to look for a ssleay32MD DLL as if it was a windows system library which was not expected behavior for me.

        My build did not fare as well because I was attempting to use https://slproweb.com/products/Win32OpenSSL.html libraries. I will now try npcg lib with MT and static runtime set. Crossing my fingers.

        Here was my configure command on that last failed build using slproweb libs

        configure -prefix C:\Qt\5.11.2_openssl -mp -debug-and-release -opengl desktop -opensource -static -static-runtime -opensource -confirm-license -no-icu -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests -skip qtactiveqt -skip qtserialport -skip qtquickcontrols -skip qtsensors -skip qtlocation -skip qtscript -platform win32-msvc -openssl-linked -I C:\OpenSSL-Win64\include -L C:\OpenSSL-Win64\lib\VC\static OPENSSL_LIBS_DEBUG="libeay32MTd.lib ssleay32MTd.lib" OPENSSL_LIBS_RELEASE="libeay32MT.lib ssleay32MT.lib"
        
        B 1 Reply Last reply 17 Oct 2018, 15:34
        0
        • B Bernard Lowe
          17 Oct 2018, 14:13

          @Cobra91151
          Your spike solution worked perfectly, it was also quite revealing because after succeeding using https://www.npcglib.org/~stathis/blog/precompiled-openssl/ MT libs with static runtime in Visual Studio, I attempted to use the MD libs and the linker attempted to look for a ssleay32MD DLL as if it was a windows system library which was not expected behavior for me.

          My build did not fare as well because I was attempting to use https://slproweb.com/products/Win32OpenSSL.html libraries. I will now try npcg lib with MT and static runtime set. Crossing my fingers.

          Here was my configure command on that last failed build using slproweb libs

          configure -prefix C:\Qt\5.11.2_openssl -mp -debug-and-release -opengl desktop -opensource -static -static-runtime -opensource -confirm-license -no-icu -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests -skip qtactiveqt -skip qtserialport -skip qtquickcontrols -skip qtsensors -skip qtlocation -skip qtscript -platform win32-msvc -openssl-linked -I C:\OpenSSL-Win64\include -L C:\OpenSSL-Win64\lib\VC\static OPENSSL_LIBS_DEBUG="libeay32MTd.lib ssleay32MTd.lib" OPENSSL_LIBS_RELEASE="libeay32MT.lib ssleay32MT.lib"
          
          B Offline
          B Offline
          Bernard Lowe
          wrote on 17 Oct 2018, 15:34 last edited by
          #18

          Failed on unresolved external errors akin to below:

          libeay32MT.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_CreateCompatibleBitmap referenced in function readscreen
          

          It looks like i need to link in GDI as well according to this Stack Overflow post

          C 1 Reply Last reply 17 Oct 2018, 17:50
          0
          • B Bernard Lowe
            17 Oct 2018, 15:34

            Failed on unresolved external errors akin to below:

            libeay32MT.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_CreateCompatibleBitmap referenced in function readscreen
            

            It looks like i need to link in GDI as well according to this Stack Overflow post

            C Offline
            C Offline
            Cobra91151
            wrote on 17 Oct 2018, 17:50 last edited by
            #19

            @Bernard-Lowe

            You need to specify additional libs to configure. I have the batch file for Qt compilation. For example, you need:

            Debug: OPENSSL_LIBS="-llibeay32MTd -lssleay32MTd -lUser32 -lAdvapi32 -lGdi32 -lCrypt32"

            Release: OPENSSL_LIBS="-llibeay32MT -lssleay32MT -lUser32 -lAdvapi32 -lGdi32 -lCrypt32"

            B 1 Reply Last reply 17 Oct 2018, 21:48
            1
            • C Cobra91151
              17 Oct 2018, 17:50

              @Bernard-Lowe

              You need to specify additional libs to configure. I have the batch file for Qt compilation. For example, you need:

              Debug: OPENSSL_LIBS="-llibeay32MTd -lssleay32MTd -lUser32 -lAdvapi32 -lGdi32 -lCrypt32"

              Release: OPENSSL_LIBS="-llibeay32MT -lssleay32MT -lUser32 -lAdvapi32 -lGdi32 -lCrypt32"

              B Offline
              B Offline
              Bernard Lowe
              wrote on 17 Oct 2018, 21:48 last edited by
              #20

              @Cobra91151 Wish that I saw your note earlier. I got it to work using this configure:

              configure -prefix C:\Qt\5.11.2_openssl -mp -debug-and-release -opengl desktop -opensource -static -static-runtime -opensource -confirm-license -no-icu -no-sql-sqlite -no-qml-debug -nomake examples -nomake tests -skip qtactiveqt -skip qtserialport -skip qtquickcontrols -skip qtsensors -skip qtlocation -skip qtscript -platform win32-msvc -openssl-linked -I C:\Development\openssl-1.0.2l-vs2017\include64 -L C:\Development\openssl-1.0.2l-vs2017\lib64 OPENSSL_LIBS_DEBUG="libeay32MTd.lib ssleay32MTd.lib gdi32.lib User32.lib" OPENSSL_LIBS_RELEASE="libeay32MT.lib ssleay32MT.lib gdi32.lib User32.lib"
              
              1 Reply Last reply
              1
              • C Cobra91151
                5 Sept 2018, 21:33

                @SGaist

                Ok. I will try the patch and reply later. Thanks.

                M Offline
                M Offline
                mcpp
                wrote on 9 Mar 2019, 15:06 last edited by
                #21

                @Cobra91151 How did you apply this patch? I'm getting errors

                C 1 Reply Last reply 9 Mar 2019, 22:29
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 9 Mar 2019, 21:46 last edited by
                  #22

                  @mcpp what exact errors ? What version 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 mcpp
                    9 Mar 2019, 15:06

                    @Cobra91151 How did you apply this patch? I'm getting errors

                    C Offline
                    C Offline
                    Cobra91151
                    wrote on 9 Mar 2019, 22:29 last edited by
                    #23

                    @mcpp

                    Hi! Please specify what issues with OpenSSL you encountered during Qt static compilation? I will try to help you.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Cobra91151
                      wrote on 10 Mar 2019, 12:00 last edited by
                      #24
                      This post is deleted!
                      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