openSSL in QT
-
sorry if this question asked before
anyone can help me to how use openssl in a project without need to build qt with openssl?
im want to post data to my https site
but its sayqt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
how can i fix this -
Hi,
The usual first step is to install OpenSSL.
-
Which OS ?
Which version of Qt ?
Which version of OpenSSL ?
How did you install Qt ? -
So I guess you are also using the MinGW build of Qt ?
-
Did you check that you have everything from the right architecture ?
-
i build openssl version 1.1.1d too
and add lib to my project
but still no luck
here my code and error
and also openssl part in pro file
win32: LIBS += -LD:/build/ver-1d-openssl/lib/ -lcrypto win32: LIBS += -LD:/build/ver-1d-openssl/lib/ -lssl INCLUDEPATH += D:/build/ver-1d-openssl/include DEPENDPATH += D:/build/ver-1d-openssl/include
edit: when i add openssl dll in debug folder of my project its work just fine
but i need static -
Your application does not link to OpenSSL nor does Qt by default.
As for when running your application, the dlls must be findable. The usual way is to copy the files in the same folder as your application or modify the PATH environment variable in the Run part of the Project panel.
-
@saeid0034 said in openSSL in QT:
but there is anyway to include openssl static?
Not without building Qt by yourself as normal Qt builds load OpenSSL libs at runtime.
-
@jsulm can anyone tell me i need to pass what in ./configure to build qt with openssl statically
i use this for build qt static for nowconfigure -opensource -confirm-license -static -platform win32-g++ -optimize-size -opengl desktop -prefix "C:\Qt\static" -skip webengine -nomake tests -nomake examples -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-tiff
i need to add what to build qt static + openssl?
edit: i see this page in wiki
based of this page i need to build qt like thisOPENSSL_LIBS='-L/d/build/ssl/lib -lssl -lcrypto' && configure -opensource -confirm-license -static -platform win32-g++ -openssl-linked -optimize-size -opengl desktop -prefix "C:\Qt\static" -skip webengine -nomake tests -nomake examples -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-tiff
in this configure OPENSSL_LIBS is Location of openssl-1.1.1g i compiled before (with mingw)
its all ok?
-
@saeid0034 said in openSSL in QT:
OPENSSL_LIBS='-L/d/build/ssl/lib -lssl -lcrypto
This looks like linking against shared OpenSSL libs.
-
You don't need to rebuild Qt. Just select OpenSSL in the installer, and do what is suggested here:
https://stackoverflow.com/questions/59507538/install-openssl-for-msvc2017-on-64-bit-windows-10
-
Then the question is: Does OpenSSL need to be static, too?
If you can live with using OpenSSL dlls while using static Qt, you can just add the following to your configure line (also with OpenSSL from the installer) and you're done.
e.g. for x86 builds:-openssl -I C:\Qt\Tools\OpenSSL\Win_x86\include -L C:\Qt\Tools\OpenSSL\Win_x86\lib