QML Image: TLS initialization failed
-
- find where your OpenSSL installation is
- in your .pro file (I assume you're using qmake), add:
LIBS+=path/to/openssl/libs INCLUDEPATH+=path/to/openssl/include
-
I've installed both x64 and x86 versions of openssl but the kit I'm using to run the project is x64 so I add:
C:\Qt\Tools\OpenSSL\Win_x64\lib
But I'm using CMake. Can I add these two lines just like the .pro file of qmake in it?
LIBS += C:\Qt\Tools\OpenSSL\Win_x64\lib // (There's no 'libs' folder in the openssl directory) INCLUDEPATH += C:\Qt\Tools\OpenSSL\Win_x64\include
-
For cmake, you should use
FindOpenSSL
: https://cmake.org/cmake/help/latest/module/FindOpenSSL.html -
I added the following two lines in the .txt file and saved the project. No errors came up:
find_package(OpenSSL) target_link_libraries(QML_5 PRIVATE OpenSSL::SSL)
But still the project can't run successfully!
-
Hi,
Which version of OpenSSL are you using ?
-
That's the minimal cmake version required to build the project.
As for OpenSSL, the installer might tell you this.
The headers of the library. -
As for OpenSSL, the installer might tell you this.
The headers of the library.Or use QSslSocket::sslLibraryVersionString.
How to use it in my QML project?
I used it this way but that doesn't work!Component.onCompleted: { console.log(QSslSocket::sslLibraryVersionString) }
-
@qcoderpro said in QML Image: TLS initialization failed:
QSslSocket::sslLibraryVersionString
Use it in you main.cpp.
-
I included these two header files:
#include <iostream> #include <QSslSocket>
and this line in main.cpp:
std::cout<< "The openSSL version is: " << QSslSocket::sslLibraryVersionString << '\n'
In return I get this warning in the Issues window and nothing related to what I foresee in Application/Compile Output windows!
warning: address of function 'QSslSocket::sslLibraryVersionString' will always evaluate to 'true'
-
QSslSocket::sslLibraryVersionString
is a static function that you have to call. -
Yes, I didn't notice the parentheses enough. Finally using:
qInfo() << QSslSocket::sslLibraryVersionString();
I could see the result:"OpenSSL 1.1.1f 31 Mar 2020"
, which is very close to what the installer showed! -
Except it should be the j release. You should ensure that this is the one used by your application.
-
You mean I have two files/packs installed as openSSL, one with
f
release and the other withj
and thatf
release is what QtCreator is using!? So what is the problem with thatf
release the IDE is using and why can't it run the program by that properly?Or probably there's a conflict between the two releases and I need to uninstall one to run the app properly! :(
But how? -
Now when I run the project, Issues, Compile Output and General Messages windows show nothing. Only Application Output shows this:
Starting ... build-QML_5-Desktop_Qt_5_15_2_MinGW_64_bit-Debug\QML_5.exe ... which shows nothing bad!So why still nothing as output is shown? :(
-
Did you check that your application shows correctly an image from your disk ?
-
Put your image element inside a window element. It's required to me.
16/24