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. Building Qt5 with OpenSSL support using VS 2015
Forum Updated to NodeBB v4.3 + New Features

Building Qt5 with OpenSSL support using VS 2015

Scheduled Pinned Locked Moved Unsolved General and Desktop
23 Posts 6 Posters 7.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.
  • C Christian Ehrlicher
    29 Jan 2019, 06:57

    @Taytoo said in Building Qt5 with OpenSSL support using VS 2015:

    -L "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x86"

    This doesn't look correct.
    And if you open the VisualStudio Command prompt then those two includes should be automatically added to the compiler - no need to specify them during qt configuration.

    T Offline
    T Offline
    Taytoo
    wrote on 29 Jan 2019, 07:57 last edited by
    #5

    @Christian-Ehrlicher The problem is VS path points to SDK version: 10.0.14393.0 - which although recent than the one above, does Not have UCRT folder so that's why include isn't working.

    I found a solution here: https://bugreports.qt.io/browse/QTBUG-50191?focusedCommentId=318801&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-318801

    but its more of a hack and I'm tyring to fix it properly.

    1 Reply Last reply
    0
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 29 Jan 2019, 08:03 last edited by
      #6

      @Christian-Ehrlicher said in Building Qt5 with OpenSSL support using VS 2015:

      -L

      You don't want -L here ...

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 29 Jan 2019, 17:35 last edited by
        #7

        Hi

        @Christian-Ehrlicher configure accepts -L and -I with a space unlike the linker and compiler options.

        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
        • C Online
          C Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 29 Jan 2019, 17:54 last edited by
          #8

          @Taytoo said in Building Qt5 with OpenSSL support using VS 2015:

          C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x86

          @SGaist: but this is an include folder. And in this folder there is the corecrt.h header file ...

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          S 1 Reply Last reply 29 Jan 2019, 20:32
          2
          • T Offline
            T Offline
            Taytoo
            wrote on 29 Jan 2019, 19:43 last edited by
            #9

            Removed VS2015 including all Windows SDKs, Installed VS2017 and its working now.

            New issue while running jom.Not sure whats it complaining about?

                    cl -c -FIqt_gui_pch.h -Yuqt_gui_pch.h -Fp.pch\release\Qt5Gui_pch.pch -nologo -Zc:wchar_t -FS -Zc:rvalueCast
             -Zc:inline -Zc:strictStrqgenericmatrix.obj : warning LNK4221: This object file does not define any previously unde
            fined public symbols, so it will not be used by any link operation that consumes this library
            qabstractlayoutstyleinfo.obj : warning LNK4221: This object file does not define any previously undefined public sy
            mbols, so it will not be used by any link operation that consumes this library
            qfragmentmap.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it
             will not be used by any link operation that consumes this library
            jom: C:\Qt\Static\5.12.0\qtbase\Makefile [sub-src-make_first] Error 2
            jom: C:\Qt\Static\5.12.0\Makefile [module-qtbase-make_first] Error 2
            
            J 1 Reply Last reply 30 Jan 2019, 05:37
            0
            • C Christian Ehrlicher
              29 Jan 2019, 17:54

              @Taytoo said in Building Qt5 with OpenSSL support using VS 2015:

              C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x86

              @SGaist: but this is an include folder. And in this folder there is the corecrt.h header file ...

              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 29 Jan 2019, 20:32 last edited by
              #10

              @Christian-Ehrlicher said in Building Qt5 with OpenSSL support using VS 2015:

              @Taytoo said in Building Qt5 with OpenSSL support using VS 2015:

              C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x86

              @SGaist: but this is an include folder. And in this folder there is the corecrt.h header file ...

              Correct, I misread the path !

              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
              • T Taytoo
                29 Jan 2019, 19:43

                Removed VS2015 including all Windows SDKs, Installed VS2017 and its working now.

                New issue while running jom.Not sure whats it complaining about?

                        cl -c -FIqt_gui_pch.h -Yuqt_gui_pch.h -Fp.pch\release\Qt5Gui_pch.pch -nologo -Zc:wchar_t -FS -Zc:rvalueCast
                 -Zc:inline -Zc:strictStrqgenericmatrix.obj : warning LNK4221: This object file does not define any previously unde
                fined public symbols, so it will not be used by any link operation that consumes this library
                qabstractlayoutstyleinfo.obj : warning LNK4221: This object file does not define any previously undefined public sy
                mbols, so it will not be used by any link operation that consumes this library
                qfragmentmap.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it
                 will not be used by any link operation that consumes this library
                jom: C:\Qt\Static\5.12.0\qtbase\Makefile [sub-src-make_first] Error 2
                jom: C:\Qt\Static\5.12.0\Makefile [module-qtbase-make_first] Error 2
                
                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 30 Jan 2019, 05:37 last edited by
                #11

                @Taytoo Did you try a complete rebuild? Delete build directory and start from scratch.

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

                T 1 Reply Last reply 30 Jan 2019, 06:20
                0
                • J jsulm
                  30 Jan 2019, 05:37

                  @Taytoo Did you try a complete rebuild? Delete build directory and start from scratch.

                  T Offline
                  T Offline
                  Taytoo
                  wrote on 30 Jan 2019, 06:20 last edited by Taytoo
                  #12

                  @jsulm tried it, no luck. This Static building thing is really getting tiring now, its been 2 days that I've been trying to get it to work. Would be nice if Qt had some tool to check for pre-requisities, paths, directories etc. Because the errors themselves are very non-descriptive so you just have to google and try to figure out what's causing failures.

                  E.g. Currently, I'm trying building in the sources folder and now i"m getting unresolved external symbols related to openssl. I checked several examples and my configure options are correct, openssl static lib is present in the correct folder, tried downloading pre-built openssl lib as well as generating my own lib, still getting the same openssl error.

                  Qt version: 5.12.0
                  MSVC2017
                  Openssl 1.1.1a

                  configure.bat -commercial -static -debug-and-release -prefix C:\Qt\Static\5.12.0 -platform win32-msvc2017 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-odbc -sql-sqlite -make libs -nomake tools -nomake examples -nomake tests OPENSSL_LIBS="-llibssl -llibcrypto" -openssl-linked -I c:/openssl/build32/include -L c:/openssl/build32/lib
                  
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _DSA_new referenced in functi
                  on "struct dsa_st * __cdecl q_DSA_new(void)" (?q_DSA_new@@YAPAUdsa_st@@XZ)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _DSA_free referenced in funct
                  ion "void __cdecl q_DSA_free(struct dsa_st *)" (?q_DSA_free@@YAXPAUdsa_st@@@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _DSA_bits referenced in funct
                  ion "int __cdecl q_DSA_bits(struct dsa_st *)" (?q_DSA_bits@@YAHPAUdsa_st@@@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _RSA_new referenced in functi
                  on "struct rsa_st * __cdecl q_RSA_new(void)" (?q_RSA_new@@YAPAUrsa_st@@XZ)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _RSA_bits referenced in funct
                  ion "int __cdecl q_RSA_bits(struct rsa_st *)" (?q_RSA_bits@@YAHPAUrsa_st@@@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _RSA_free referenced in funct
                  ion "void __cdecl q_RSA_free(struct rsa_st *)" (?q_RSA_free@@YAXPAUrsa_st@@@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _DH_new referenced in functio
                  n "struct dh_st * __cdecl q_DH_new(void)" (?q_DH_new@@YAPAUdh_st@@XZ)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _DH_free referenced in functi
                  on "void __cdecl q_DH_free(struct dh_st *)" (?q_DH_free@@YAXPAUdh_st@@@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _DH_bits referenced in functi
                  on "int __cdecl q_DH_bits(struct dh_st *)" (?q_DH_bits@@YAHPAUdh_st@@@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _DH_check referenced in funct
                  ion "int __cdecl q_DH_check(struct dh_st *,int *)" (?q_DH_check@@YAHPAUdh_st@@PAH@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _d2i_DHparams referenced in f
                  unction "struct dh_st * __cdecl q_d2i_DHparams(struct dh_st * *,unsigned char const * *,long)" (?q_d2i_DHparams@@YAPAUdh
                  _st@@PAPAU1@PAPBEJ@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _i2d_DHparams referenced in f
                  unction "int __cdecl q_i2d_DHparams(struct dh_st *,unsigned char * *)" (?q_i2d_DHparams@@YAHPAUdh_st@@PAPAE@Z)
                  Qt5Network.lib(qsslsocket_openssl_symbols.obj) : error LNK2019: unresolved external symbol _DH_get0_pqg referenced in fu
                  nction "void __cdecl q_DH_get0_pqg(struct dh_st const *,struct bignum_st const * *,struct bignum_st const * *,struct big
                  num_st const * *)" (?q_DH_get0_pqg@@YAXPBUdh_st@@PAPBUbignum_st@@11@Z)
                  ..\..\..\bin\canbusutil.exe : fatal error LNK1120: 244 unresolved externals
                  jom: C:\Qt\Static\qt-everywhere-src-5.12.0\qtserialbus\src\tools\canbusutil\Makefile.Release [..\..\..\bin\canbusutil.ex
                  e] Error 1120
                  jom: C:\Qt\Static\qt-everywhere-src-5.12.0\qtserialbus\src\tools\canbusutil\Makefile [release] Error 2
                  jom: C:\Qt\Static\qt-everywhere-src-5.12.0\qtserialbus\src\tools\Makefile [sub-canbusutil-make_first] Error 2
                  jom: C:\Qt\Static\qt-everywhere-src-5.12.0\qtserialbus\src\Makefile [sub-tools-make_first] Error 2
                  jom: C:\Qt\Static\qt-everywhere-src-5.12.0\qtserialbus\Makefile [sub-src-make_first] Error 2
                  jom: C:\Qt\Static\qt-everywhere-src-5.12.0\Makefile [module-qtserialbus-make_first] Error 2
                  
                  1 Reply Last reply
                  0
                  • C Online
                    C Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 30 Jan 2019, 06:53 last edited by
                    #13

                    Are you building for 64 or 32 bit target architecture?
                    And since you've a commercial license you could ask the Qt Company for help.

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    T 1 Reply Last reply 30 Jan 2019, 07:35
                    1
                    • C Christian Ehrlicher
                      30 Jan 2019, 06:53

                      Are you building for 64 or 32 bit target architecture?
                      And since you've a commercial license you could ask the Qt Company for help.

                      T Offline
                      T Offline
                      Taytoo
                      wrote on 30 Jan 2019, 07:35 last edited by
                      #14

                      @Christian-Ehrlicher said in Building Qt5 with OpenSSL support using VS 2015:

                      Are you building for 64 or 32 bit target architecture?
                      And since you've a commercial license you could ask the Qt Company for help.

                      32-bit.

                      I'm currently evaluating QT for our commercial software, thought the setup would be straightforward but keep running into one issue after another, so treating it as learning process - still frustrating though.

                      1 Reply Last reply
                      0
                      • C Online
                        C Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 30 Jan 2019, 08:20 last edited by
                        #15

                        Can you show us the link line of Qt5Network.lib? Must be directly above the linker errors.

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          Taytoo
                          wrote on 30 Jan 2019, 08:32 last edited by
                          #16

                          Finally, got it working! Re-set everything again, unzipped fresh sources etc and used this configure...

                          configure -commercial -static -debug-and-release -prefix C:\Qt\Static\5.12.0 -platform win32-msvc2017 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-odbc -sql-sqlite -make libs -nomake tools -nomake examples -nomake tests -openssl-linked OPENSSL_LIBS="-llibssl -llibcrypto" -I c:\openssl\build32\include -L c:\openssl\build32\lib
                          

                          not sure if moving openssl-linked ahead made any difference, but I'll just save these settings and stick with them.

                          Now, how do I update my Visual studio project to link QT statically?

                          T 1 Reply Last reply 30 Jan 2019, 10:00
                          0
                          • T Taytoo
                            30 Jan 2019, 08:32

                            Finally, got it working! Re-set everything again, unzipped fresh sources etc and used this configure...

                            configure -commercial -static -debug-and-release -prefix C:\Qt\Static\5.12.0 -platform win32-msvc2017 -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-odbc -sql-sqlite -make libs -nomake tools -nomake examples -nomake tests -openssl-linked OPENSSL_LIBS="-llibssl -llibcrypto" -I c:\openssl\build32\include -L c:\openssl\build32\lib
                            

                            not sure if moving openssl-linked ahead made any difference, but I'll just save these settings and stick with them.

                            Now, how do I update my Visual studio project to link QT statically?

                            T Offline
                            T Offline
                            Taytoo
                            wrote on 30 Jan 2019, 10:00 last edited by
                            #17

                            Still working on the static environment setup, getting whole bunch of unresolved external errors. The build config is Win32, which is inline with static qt win32 build. also double checked and QT libs are added as Additional libraries in project settings.

                            In the image below, first two errors are related to an internal lib. The remaining errors are all unresolved externals. I did go through an interesting checklist here (https://heejune.me/2015/12/03/resolving-the-lnk2019-error-while-link-qt-app/) and don't see anything that applies to my config.
                            0_1548842162714_unresolved.JPG

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 30 Jan 2019, 22:02 last edited by
                              #18

                              Hi,

                              Might be a silly question but why are you using the VS2017 mkspec for VS2015 ?

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

                              T 1 Reply Last reply 31 Jan 2019, 02:37
                              0
                              • S SGaist
                                30 Jan 2019, 22:02

                                Hi,

                                Might be a silly question but why are you using the VS2017 mkspec for VS2015 ?

                                T Offline
                                T Offline
                                Taytoo
                                wrote on 31 Jan 2019, 02:37 last edited by
                                #19

                                @SGaist I moved to VS17 because I was getting corecrt errors while building QT.

                                Two unresolved errors were solved by adding ws2_32.lib. Also, went into Qt Project Settings - Qt Modules and checked a whole bunch of modules. Now I'm getting only one linker error. Maybe its related to the two E2512 errors?

                                0_1548902195774_unresolved2.JPG

                                1 Reply Last reply
                                0
                                • T Offline
                                  T Offline
                                  Taytoo
                                  wrote on 31 Jan 2019, 10:54 last edited by
                                  #20

                                  I've managed to fix the preprocessor error but still not able to figure out linker error. Weird thing is that I've tried compiling my app by linking dynamically with QT (default config) and even that is giving out the same error, so its probably not something specific to static linking with QT.

                                  Last time my project was compiling successfully in VS2015 against qt dlls. Uninstalled VS2015, installed VS2017 and now seeing this linker error. Any tips?

                                  1 Reply Last reply
                                  0
                                  • T Offline
                                    T Offline
                                    Taytoo
                                    wrote on 31 Jan 2019, 21:43 last edited by
                                    #21

                                    Fixed my compilation issue and also Found a Bug in Qt.

                                    Repro: In Visual Studio. Go to Qt VS Tools -> Qt Project Settings -> Qt Modules (Tab) and make changes. This will add

                                    \
                                    $(INHERIT)\
                                    

                                    into the project's Linker -> Additional Dependencies. Removing the slashes solved the problem. No wonder I couldn't figure out what the object file was when I was getting ".obj" error during compilation.

                                    1 Reply Last reply
                                    0
                                    • T Offline
                                      T Offline
                                      Taytoo
                                      wrote on 1 Feb 2019, 02:39 last edited by
                                      #22
                                              cd examples\ && ( if not exist Makefile C:\Qt\Static\qt-everywhere-src-5.12.0\qtbase\bin\qmake.exe -o Makefile C
                                      :\Qt\Static\qt-everywhere-src-5.12.0\qtnetworkauth\examples\examples.pro ) && "C:\Program Files (x86)\Microsoft Visual S
                                      tudio\2017\Professional\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\nmake.exe" -f Makefile distclean
                                      ASSERT: "fileName.isEmpty() || isAbsolutePath(fileName)" in file C:\Qt\Static\qt-everywhere-src-5.12.0\qtbase\qmake\libr
                                      ary\ioutils.cpp, line 53
                                      NMAKE : fatal error U1077: 'cd' : return code '0x40000015'
                                      Stop.
                                      NMAKE : fatal error U1077: 'cd' : return code '0x2'
                                      Stop.
                                      

                                      When I run nmake distclean in sources folder, its keeps running for a while and eventually ends with this error. I built Qt with "nomake examples" flag, is that the reason? Do I need to unzip fresh sources again or can I just ignore this and continue by calling configure and jom?

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on 8 Feb 2019, 20:24 last edited by
                                        #23

                                        No, examples are just normal projects. You can open them in Qt Creator and build them from there.

                                        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