QT https SSL对静态QT静态程序构建的支持-获取'Protocol'https'未知” [英] QT https SSL support for static QT static program build - getting 'Protocol "https" is unknown'

查看:574
本文介绍了QT https SSL对静态QT静态程序构建的支持-获取'Protocol'https'未知”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试静态编译为Windows创建的QT程序,并不断收到错误消息,运行在更新函数使用的地址中使用https的更新数据库函数时,协议 https是未知的。当我安装了openssl时,它可以通过QT Creator运行,但是显然静态可执行文件没有适当的库来执行https。我确实找到了 this 。我在网上寻找解决方案,但没有找到。到目前为止,这是我所做的事情:

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. 编辑了powershell脚本此处包括用于-configure.bat而不是-no-openssl的-openssl-link参数

  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"


  • 经过验证的config.summary包含以下内容:

  • verified config.summary to contain the following:

    SSL支持.....链接

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

    OpenSSL支持.......... linked

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

    在我的版本中放入openssl库libeay32.dll和libssl32.dll和ssleay32.dll发布目录,并在目录中编译了可执行文件

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

    输入以下qt项目文件:

    put the following the qt project file:

    INCLUDEPATH + = C:\OpenSSL-Win32\include

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

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

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

    但是,我没有做的一件事是在使用powershell脚本的原始QT静态版本与使用-openssl-linked选项的后续版本之间进行清理。不知道那是否有必要。有任何想法吗?谢谢!

    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!

    推荐答案

    尽管 configure 表示什么,但您没有提供了足够的信息来配置以使其与OpenSSL链接Qt。

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

    您需要在构建Qt与OpenSSL时对其进行链接。将以下参数传递给 configure (这是Qt 5):

    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"
    

    b
    $ b

    在构建项目时无需传递任何特殊参数。

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

    以上内容假设使用 Shining Light Productions ,Windows的事实上的OpenSSL二进制提供者。

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

    这篇关于QT https SSL对静态QT静态程序构建的支持-获取'Protocol'https'未知”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆