Build QT 5.4.2 with OpenSSL statically linked



  • 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


  • Lifetime Qt Champion

    Hi,

    What symbols are missing ?

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


  • Moderators

    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.



  • 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


  • Lifetime Qt Champion

    Looks like you need to add -lgdi32 and -lUser32



  • @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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.