Official guide for compiling static QT with SSL support (possibly using OpenSSL toolkit already included in QT)
-
Shouldn't that be
-lssl -lcrypto
? -
@Giovanni-R try downloading ssl binaries precompiled with mingw or compile them from sources, those provided by Qt are compiled with MSVC. I don't say this is exactly the reason but I would definitely try.
-
@Giovanni-R I had, some time ago, an issue where my software was working on some machines and on some machines not (login to external service was failing). It was very frustrating as all libs were in place and on some it was indeed working... I finally did my due diligence and found out, that some of the machines had vcredist libs and those were working fine, some others had not and those were failing. Then I checked the Qt libraries and the truth came out.
When you go to the https://wiki.openssl.org you'll undoubtedly find the list of mirrors. I needed 1.1.1.4 (1.1.1.d) then and I am not sure which ones you'll need (info about OpenSSL compatibility per version should be somewhere in docs as this is where I took it from). I used this site to obtain binaries: https://github.com/curl/curl-for-win#binary-package-downloads
You will need curl, please take time to read how to obtain binaries in required version.
Of course, you're most welcome to pursue any other source of binaries you find trustworthy, there is a few.
-
There are test logs generated, you should be able to find there the exact error regarding OpenSSL.
-
Trying source 0 (type inline) of library openssl_headers ... openssl/ssl.h not found in [] and global paths. openssl/opensslv.h not found in [] and global paths. => source produced no result. test config.qtbase_network.libraries.openssl_headers FAILED Trying source 0 (type makeSpec) of library network ... => source accepted. loaded result for config test config.qtbase_network.tests.getifaddrs + cd /d C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\config.tests\getifaddrs && C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\qtbase\bin\qmake.exe "CONFIG -= qt debug_and_release app_bundle lib_bundle" "CONFIG += static warn_off console single_arch" "QMAKE_USE += network" "QMAKE_LIBS_NETWORK = -lws2_32" C:/Qt/Static5152/src/qt-everywhere-src-5.15.2/config.tests/getifaddrs + cd /d C:\Qt\Static5152\src\qt-everywhere-src-5.15.2\config.tests\getifaddrs && set MAKEFLAGS=& mingw32-make > g++ -c -fno-keep-inline-dllexport -O2 -w -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_STATIC_BUILD -I. -IC:\Qt\Static5152\src\qt-everywhere-src-5.15.2\qtbase\mkspecs\win32-g++ -o main.o main.cpp > main.cpp:3:10: fatal error: sys/socket.h: No such file or directory > #include <sys/socket.h> > ^~~~~~~~~~~~~~
I want to focus on that part of the config.log... (it's taken from a powershell script so it has some escaping)
"openssl/ssl.h not found in [] and global paths.
openssl/opensslv.h not found in [] and global paths."config line is
configure.bat -opensource -confirm-license -static -debug-and-release -platform win32-g++ -prefix $QtDir -openssl-linked -I 'C:\Qt\Tools\OpenSSL\src\include\openssl' -L 'C:\Qt\Tools\OpenSSL\Win_x64\lib' OPENSSL_LIBS=`"-lssl -lcrypto`" -skip webengine -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -sql-sqlite -make libs -nomake tools -nomake examples -nomake tests
i tried with -I C:\Qt\Tools\OpenSSL\src\include also but same result and i can tell you for sure that in C:\Qt\Tools\OpenSSL\src\include\openssl there is both opensslv.h and ssl.h (ssl toolkit from qt installer).
So why the config is not able to find them?
And also...
main.cpp:3:10: fatal error: sys/socket.h: No such file or directory
#include <sys/socket.h>i don't feel like that one is usual. Am i wrong?
I mean it's crazy to me that i have to be stopped 2wks by stuff like that :/ -
@Giovanni-R said in Official guide for compiling static QT with SSL support (possibly using OpenSSL toolkit already included in QT):
-I 'C:\Qt\Tools\OpenSSL\src\include\openssl'
Change to
-I 'C:\Qt\Tools\OpenSSL\src\include
But keep in mind that you should always do a complete rebuild (without old build artefacts)!
-
Nuking the whole folder and starting again seems to have fixed the issue (or at least, it seems like now it finds the headers that were missing) but now it's not even starting to compile
"mingw32-make: *** No targets specified and no makefile found. Stop.
mingw32-make: *** No rule to make target 'install'."https://pastebin.com/XbrWwffA
This is the config.logIt misses random stuff, that was not missing last time i compiled with the same configure...i don't know if that's just me or the whole thing is utterly unusable (maybe it's Windows..i don't know...but still...)
-
@Giovanni-R Did you also run configure again?
-
@Bonnie finger crossed, QSslSocket::supportsSsl(); using the build compiled with OPENSSL_PREFIX seems to return true, so i'm pretty optimistic about the thing that it should work properly!
I don't know if i'm finally out of that nightmare but a huge THANKS in any case