OpenSource build of Qt5.15 with OpenSSL 1.1.1g statically linked - precondition libs.openssl failed
-
wrote on 2 Sept 2020, 00:10 last edited by
I am returning to a code base that had been developed 6-7 years ago and am tasked with moving it to "current" tools and versions (joy!).
The original code used a build of Qt 5.4 with OpenSSL 1.0.2d statically linked.
I downloaded the source for OpenSSL 1.1.1g and built the win32 release target.
Then I downloaded the zip file of the Qt5.15 files from https://download.qt.io/archive/qt/5.15/5.15.0/single and unzipped it to do the build. I am using a Windows 10 machine with Visual Studio 2019.
Based on the old "config" arguments that we used when building Qt 5.4, I am trying to use similar arguments for the Qt 5.15 build:
configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release -openssl-linked OPENSSL_LIBS="-llibcrypto -llibssl" -I C:\SSLBuild\Lib\x32\Release\include -L C:\SSLBuild\Lib\x32\Release\lib
When I try to run this, I get the following error: ERROR:: Feature 'openssl-linked' was enabled, but the pre-condition '!features.securetransport && !features.schannel && libs.openssl' failed.
Google searches have led me to various attempts to tweak the format in which the OpenSSL header file and library paths are specified, but I always get the same results. (I also learned to delete the config.cache file!!!)
The contents of the config.log have not been useful to me in attempting to determine the issue.
Any help/guidance would be appreciated. Seems like this "should" be do-able.
Thanks,
Bob
-
wrote on 4 Sept 2020, 02:55 last edited by Bonnie 9 Apr 2020, 03:05
Quoted from 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 -lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32 # - libs in <OPENSSL_DIR>\lib\VC\static # - configure: -openssl-linked -openssl-linked OPENSSL_INCDIR="%OPENSSL_DIR%\include" OPENSSL_LIBDIR="%OPENSSL_DIR%\lib\VC\static" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32" OPENSSL_LIBS_DEBUG="-llibssl64MDd -llibcrypto64MDd" OPENSSL_LIBS_RELEASE="-llibssl64MD -llibcrypto64MD"
-
Hi and welcome to devnet,
@Robert_C said in OpenSource build of Qt5.15 with OpenSSL 1.1.1g statically linked - precondition libs.openssl failed:OPENSSL_LIBS="-llibcrypto -llibssl"
Shouldn't that be "-lssl -lcrypto" ?
-
wrote on 3 Sept 2020, 00:05 last edited by
The libs created when building OpenSSL 1.1.1g were libcrypto.lib and libssl.lib. This is not a universe I normally play in. Perhaps the library names changed recently? They DEFINITELY changed completely from the days of 1.0.2d!
;-)
Bob
-
When passing a library to the linker you drop the lib prefix.
-
wrote on 3 Sept 2020, 20:57 last edited by
Will give it a try later today and post my results. I have never seen the name of a library being used by Visual Studio modified. Thanks for the suggestion and I'll be back with the results.
-
wrote on 3 Sept 2020, 21:21 last edited by
No change. Used the following arguments and got the same result:
configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release -openssl-linked OPENSSL_LIBS="-lssl -lcrypto" -I C:\SSLBuild\Lib\x32\Release\include -L C:\SSLBuild\Lib\x32\Release\lib
Is there a way to upload my config.log?
There must be folks that do this using Windows 10 and Visual Studio 2019:
-
Download OpenSSL 1.1.1g and build the Win32 release target
-
Download Qt5.15 source and build statically linked to the OpenSSL libraries.
Thank you very much for your ongoing assistance attempts.
Bob
-
-
wrote on 3 Sept 2020, 21:42 last edited by
Rolled my sleeves up on that last attempt and worked on analyzing the config.log. It looks like the entries relevant to the "failure" are the following:
test config.qtbase_corelib.tests.atomicfptr succeeded <--- Last line in file from "previous" test
looking for library openssl
Trying source 0 (type openssl) of library openssl ...
$OPENSSL_LIBS is not set.
=> source produced no result.Bob
-
wrote on 3 Sept 2020, 22:00 last edited by
From Qt bug reports like:
https://bugreports.qt.io/browse/QTBUG-65501
https://bugreports.qt.io/browse/QTBUG-62733It looks like using the full OpenSSL library names, including the "lib" prefix is normal.
Bob
-
wrote on 3 Sept 2020, 23:41 last edited by
Found examples on the internet that seem to show the lib path and the libs being both specified in the OPENSSL_LIBS value. So, I tried both of the following 'configure' argument sets, one with the "lib" prefix and one without.
There was no change in behavior.
configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release OPENSSL_LIBS="-LC:\SSLBuild\Lib\x32\Release\lib -lssl -lcrypto" -openssl-linked -I C:\SSLBuild\Lib\x32\Release\include
configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release OPENSSL_LIBS="-LC:\SSLBuild\Lib\x32\Release\lib -llibssl -llibcrypto" -openssl-linked -I C:\SSLBuild\Lib\x32\Release\include
Bob
-
wrote on 4 Sept 2020, 02:55 last edited by Bonnie 9 Apr 2020, 03:05
Quoted from 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 -lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32 # - libs in <OPENSSL_DIR>\lib\VC\static # - configure: -openssl-linked -openssl-linked OPENSSL_INCDIR="%OPENSSL_DIR%\include" OPENSSL_LIBDIR="%OPENSSL_DIR%\lib\VC\static" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32" OPENSSL_LIBS_DEBUG="-llibssl64MDd -llibcrypto64MDd" OPENSSL_LIBS_RELEASE="-llibssl64MD -llibcrypto64MD"
-
wrote on 4 Sept 2020, 16:20 last edited by
Thank you Bonnie! That information was invaluable. Based on what you shared, I used the following configure command:
configure -prefix c:\Qt5_15_Build -opensource -confirm-license -nomake tests -nomake examples -platform win32-msvc -opengl desktop -debug-and-release -openssl-linked OPENSSL_INCDIR="C:\SSLBuild\Lib\x32\Release\include" OPENSSL_LIBDIR="C:\SSLBuild\Lib\x32\Release\lib" OPENSSL_LIBS="-lWs2_32 -lGdi32 -lAdvapi32 -lCrypt32 -lUser32" OPENSSL_LIBS_DEBUG="-llibssl -llibcrypto" OPENSSL_LIBS_RELEASE="-llibssl -llibcrypto"
This completed and I'm now ready to fire up nmake. (I may go back and build the debug OpenSSL libs, but for now I'm linking the release SSL libs into both the Qt Debug and Release builds.)
The nmake ought to take 2-3 minutes, right?
;-)
Bob
-
@Robert_C said in OpenSource build of Qt5.15 with OpenSSL 1.1.1g statically linked - precondition libs.openssl failed:
The nmake ought to take 2-3 minutes, right?
Use jom, it will parallelise your build, nmake is sequential.
8/12