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. Build QT 5.4.2 with OpenSSL statically linked

Build QT 5.4.2 with OpenSSL statically linked

Scheduled Pinned Locked Moved Solved Installation and Deployment
opensslwindowsqt 5.4.2build
7 Posts 4 Posters 6.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.
  • Paul H.P Offline
    Paul H.P Offline
    Paul H.
    wrote on last edited by A Former User
    #1

    Hello,
    I built both static and shared release libraries for OpenSSL in separate folders. The static version does not have any dlls in the bin folder, as expected, but when I try to build QT with -openssl-linked option , using the static lib folder, it fails with unresolved references. I have the OpenSSL static bin folder in my path when trying to build. Should I just change it to the shared bin folder, which has the dlls? Or is there something else I need to do?

    I should note that everything builds fine with just -openssl option.

    Environment:
    Windows 7 64bit
    VS2012 64bit toolchain
    QT 5.4.2 source from git
    ICU 55.1
    OpenSSL 1.0.2c

    Configure options:
    ..\qt5\configure.bat -prefix %_DEST_DIR% -debug-and-release -opensource -opengl desktop -confirm-license -nomake tests -nomake examples -mp -icu -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32"

    Thank you,
    Paul

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

      Hi,

      What symbols are missing ?

      I don't see any additional path to find ssleay32 and libeay32, are you sure they are found ?

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

      Paul H.P 1 Reply Last reply
      0
      • A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        Another thing I've seen before is people in windows mixing binary types. If you are using say MSVC to build openssl and then mingw to build your application it will "fail to find" the libraries even though it actually finds them.

        The failure is because it doesn't recognize them as shared objects properly.

        More than likely it is a path issue like SGaist said. If you add -L/path/to/openssl/libs in your configure it should work.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          What symbols are missing ?

          I don't see any additional path to find ssleay32 and libeay32, are you sure they are found ?

          Paul H.P Offline
          Paul H.P Offline
          Paul H.
          wrote on last edited by
          #4

          I have the paths to the lib and include directories appended to the LIB and INCLUDE variable. I tried again with the following config:
          ..\qt5\configure.bat -prefix %_DEST_DIR% -debug-and-release -opensource -opengl desktop -confirm-license -nomake tests -nomake examples -mp -icu -openssl-linked OPENSSL_LIBS="-lssleay32 -llibeay32" -L G:\Qt5\openssl-1.0.2c_vs2012_rel_static\lib -I G:\Qt5\openssl-1.0.2c_vs2012_rel_static\include

          The following is the error:
          Creating library ..\..\lib\Qt5Networkd.lib and object ..\..\lib\Qt5Networkd.exp libeay32.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp_GetProcessWindowStation referenced in function OPENSS L_isservice libeay32.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp_GetUserObjectInformationW referenced in function OPEN SSL_isservice libeay32.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp_MessageBoxW referenced in function OPENSSL_showfatal libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_CreateCompatibleBitmap referenced in function readscr een libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_DeleteObject referenced in function readscreen libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_GetDeviceCaps referenced in function readscreen libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_GetDIBits referenced in function readscreen libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_GetObjectW referenced in function readscreen libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_GetDC referenced in function readscreen libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp_ReleaseDC referenced in function readscreen ..\..\lib\Qt5Networkd.dll : fatal error LNK1120: 10 unresolved externals

          G:\Qt5\openssl-1.0.2c_vs2012_rel_static\lib contains libeay32.lib (15,470 KB) and ssleay32.lib (2,269 KB).
          I built these with VS2012 toolchain from a VS2012 64bit command prompt. The shared version I built in the same environment works for -openssl option instead of linked. I don't have any of my MinGW paths in the build environment I am using for this build. I tried the -L path in the configure with forward and back slashes with the same outcome.
          Anything else I can check? I'll try re-building the openssl static libs from scratch and see if it makes a difference.

          Thank you for the help,
          Paul

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

            Looks like you need to add -lgdi32 and -lUser32

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

            Paul H.P 1 Reply Last reply
            2
            • SGaistS SGaist

              Looks like you need to add -lgdi32 and -lUser32

              Paul H.P Offline
              Paul H.P Offline
              Paul H.
              wrote on last edited by
              #6

              @SGaist Thank you! That did it. I'll remember from now on to google the references and not assume they are part of the library I am trying to link. I really appreciate your help.
              Paul

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Roman H.
                wrote on last edited by
                #7

                For the people googleing this issue. There is documentation abut this in
                qtbase/src/network/ssl/ssl.pri:

                Add optional SSL libs

                # Static linking of OpenSSL with msvc:
                #   - Binaries http://slproweb.com/products/Win32OpenSSL.html
                #   - also needs -lUser32 -lAdvapi32 -lGdi32 -lCrypt32
                #   - libs in <OPENSSL_DIR>\lib\VC\static
                #   - configure: -openssl -openssl-linked -I <OPENSSL_DIR>\include -L <OPENSSL_DIR>\lib\VC\static OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32" OPENSSL_LIBS_DEBUG="-lssleay32MDd -llibeay32MDd" OPENSSL_LIBS_RELEASE="-lssleay32MD -llibeay32MD"
                
                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