jurplel / install-qt-action

Install Qt on your Github Actions workflows with just one simple action
MIT License
459 stars 78 forks source link

OpenSSL libs missing #136

Closed txtsd closed 2 years ago

txtsd commented 2 years ago

When I use this action to install Qt on windows-2022, build a project with it, and bundle up the artifact, the resulting binaries fail at making network requests, spitting out QNetworkReply::UnknownNetworkErrors.

The URLs are all https.

There need to be libssl.dll and libcrypto.dll, or libeay.dll and ssleay.dll (not sure which ones are the current standard), in the installed Qt folder that will be included in the build.

txtsd commented 2 years ago

I understand that I can add it with tools: 'tools_openssl_x64', however, I do not know how to access the contents of the tool from within a workflow.

guysoft commented 2 years ago

I also need SSL and not sure how to find it

pzhlkj6612 commented 2 years ago

Hi there!


There need to be libssl.dll and libcrypto.dll, or libeay.dll and ssleay.dll (not sure which ones are the current standard), in the installed Qt folder that will be included in the build.

Since version 1.1.0, OpenSSL has renamed their library names on Windows:

That is, "libssl-*.dll" and "libcrypto-*.dll" are newer.


I understand that I can add it with tools: 'tools_openssl_x64', however, I do not know how to access the contents of the tool from within a workflow.

I also need SSL and not sure how to find it

Well, if I recall correctly, developers have to bundle the built app with OpenSSL library (the two dll files) manually. Assuming we are using Qt 5 and OpenSSL 1.1, execute the following commands to copy them:

$ErrorActionPreference = 'Stop'

Push-Location -Path "${env:Qt5_DIR}\Tools\OpenSSL\Win_x64\bin"

Copy-Item -PassThru -Path 'libcrypto-1_1-x64.dll' -Destination 'path\to\the\directory\contains\the\built\exe'
Copy-Item -PassThru -Path 'libssl-1_1-x64.dll'    -Destination 'path\to\the\directory\contains\the\built\exe'

Pop-Location

Then, package and upload your app. I think it should work on any still-supported Windows computers.


As per [QTBUG-82876] [Windows]: Switch default builds to use Secure Channel for SSL sockets - Qt Bug Tracker, starting from Qt 6.2.0, we may be able to use basic TLS features without OpenSSL. I didn't test it, so just in theory though.
Also take a look at Secure Sockets Layer (SSL) Classes | Qt Network 6.

txtsd commented 2 years ago

Thanks!

guysoft commented 2 years ago

If anyone needs it, I built a github action that takes the dlls from msys2 github action: https://github.com/guysoft/pi-imager/blob/qml/.github/workflows/build-windows.yml#L59