Unsolved OpenSSL 1.1.1c Toolkit in clean Windows 10
-
I have the last version Qt 5.13.0 (online installer) with OpenSSL 1.1.1c Toolkit . I created simple QtWidget application with one https request (MinGW 64bit). I added the path
D:\Qt\Tools\OpenSSL\Win_x64\bin
to the system variablePATH
.QT += core gui network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = untitled1 TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS CONFIG += c++11 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { QNetworkAccessManager *manager; QNetworkRequest request; QSslConfiguration sSlConfig; sSlConfig.setDefaultConfiguration(QSslConfiguration::defaultConfiguration()); sSlConfig.setProtocol(QSsl::TlsV1_2); request.setSslConfiguration(sSlConfig); request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); request.setUrl(QUrl("https://www.google.com/")); manager->get(request); } void MainWindow::replyFinished(QNetworkReply* reply) { if (reply->error() == QNetworkReply::NoError) { QByteArray bytes = reply->readAll(); QString html = QString::fromUtf8(bytes.data(), bytes.size()); int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); QString url = reply->url().toString(); ui->textEdit->insertPlainText("statusCode = " + QString::number(statusCode) + "\n"); ui->textEdit->insertPlainText("url = " + url + "\n"); ui->textEdit->insertPlainText("html = " + html + "\n"); } else { qDebug() << reply->errorString(); } reply->deleteLater(); }
And application works.
Then I want to run the EXE file in a clean Windows 10. For running an application I use these dll:
- libgcc_s_seh-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
- Qt5Core.dll
- Qt5Gui.dll
- Qt5Network.dll
- Qt5Widgets.dll
- platforms
- └───qwindows.dll
Apllication runs, but https request does not work. I understand that I need to add dll files for OpenSSL. But https request do not work again after adding dll files from
D:\Qt\Tools\OpenSSL\Win_x64\bin
:- libcrypto-1_1-x64.dll
- libssl-1_1-x64.dll
But when I use vesrions of these dll files from https://slproweb.com/products/Win32OpenSSL.html (Win64 OpenSSL v1.1.1c) my application works in clean Windows 10 (after installing
vc_redist.x64.exe
).What could be the problem with the files
libcrypto-1_1-x64.dll
andlibssl-1_1-x64.dll
in the folderD:\Qt\Tools\OpenSSL\Win_x64\bin
? -
Hi,
Likely because they are not built with the same compiler. Qt Creator is built with Visual Studio while you are using MinGW.
-
@SGaist No. Files from slproweb.com compiled under Visual Studio and require
vc_redist.x64.exe
. But they work with my apllication compiled underMinGW 64bit
.And now I compiled my test application under
MSVC2017 64bit
. And situation is the same. Files from slproweb.com work with the application, but files fromD:\Qt\Tools\OpenSSL\Win_x64\bin
do not work in a clean Windows 10. -
Right ! These are C libraries !
Check these .dlls with Dependency Walker, you might find so what differs between these sets.
By the way, can you check which version of Qt was used to build Qt Creator ?
-
@Harrix Did you resolve this? I have the same issue. If I install Qt/Felgo on the clean pc, the app can work. I think I'm missing a dll when deploying the app.