I'm trying to link openssl with qt5.12 but the result differs when running executable from qt and from command line. I use QSslSocket::supportsSsl(), QSslSocket::sslLibraryVersionString() and QSslSocket::sslLibraryBuildVersionString() to observe the results. When running exe from qt i get the following output respectively true
OpenSSL 1.1.1d 10 Sep 2019
OpenSSL 1.1.1k 25 Mar 2021
and for command line false
""
OpenSSL 1.1.1k 25 Mar 2021
. The exe is compiled with msvc 2017 64 bit. What could be the problem and where does qt get that library from?
Using listdlls tool i managed to find the name and location of openssl DLLs. They're libssl-1_1-x64.dll
and libcrypto-1_1-x64.dll
and located in %QT_INSTALL_PATH%/Tools/QtCreator/bin
. Copying those DLLs to the build folder of the project solved the issue.
QtCreator used build environment which is apparently the default environment and can be found in Projects -> Run
. It sets a number of environment variables, and in my case exactly, it updated the PATH
variable adding the path of QtCreator bin folder.