Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QT https SSL support for static QT static program build - getting 'Protocol "https" is unknown'

Hi I am trying to compile a QT program I made for Windows statically and keep getting the error Protocol "https" is unknown when running an update database function that uses https in the address that the update function uses. It works when run through QT Creator as I have openssl installed however apparently the static executable doesn't have the proper libraries to do https. I did find this and this. I looked all over the net trying to find a solution but couldn't. Here's what I've done so far:

  1. edited the powershell script here to include the parameter -openssl-linked for configure.bat instead of -no-openssl

    $env:SystemRoot\System32\cmd.exe /c "configure.bat -static -debug-and-release -platform win32-g++ -prefix $QtDir
    -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sql-sqlite -openssl-linked
    -opensource -confirm-license
    -make libs -nomake tools -nomake examples -nomake tests"
    
  2. verified config.summary to contain the following:

    SSL support.................linked

    OpenSSL support.............linked

  3. Put openssl libraries libeay32.dll and libssl32.dll and ssleay32.dll in my build release directory with the executable compiled in the directory

  4. put the following the qt project file:

    INCLUDEPATH += "C:\OpenSSL-Win32\include"

    LIBS += -LC:\OpenSSL-Win32\lib -llibeay32 -lssleay32

One thing I didn't do however was a clean between the original QT static build using the powershell script and the subsequent build with the -openssl-linked option. Don't know if that would be necessary. Any ideas? Thanks!

like image 958
riverofwind Avatar asked Jul 14 '26 05:07

riverofwind


1 Answers

In spite of what configure indicates, you have not provided enough information to configure to let it link Qt with OpenSSL.

You need to link Qt with OpenSSL at the time it is being built. Pass the following arguments to configure (this is for Qt 5):

-openssl-linked
-I C:\OpenSSL-Win32\include
-L C:\OpenSSL-Win32\lib\VC\static
OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32 -lCrypt32"
OPENSSL_LIBS_DEBUG=-"lssleay32MTd -llibeay32MTd"
OPENSSL_LIBS_RELEASE="-lssleay32MT -llibeay32MT"

There's no need for any special parameters to be passed while building your project.

The above assumes a build from Shining Light Productions, the de-facto OpenSSL binary purveyor for Windows.

like image 158
Kuba hasn't forgotten Monica Avatar answered Jul 17 '26 16:07

Kuba hasn't forgotten Monica



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!