有什么方法可以使用静态OpenSSL构建静态Qt? [英] Is there any way to building static Qt with static OpenSSL?

查看:295
本文介绍了有什么方法可以使用静态OpenSSL构建静态Qt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

原始问题略有不同,但是更主要问题的一部分.

Original question was slightly different but part of a more major question.

我正在尝试在Windows上使用静态OpenSSL将Qt 5.2构建为静态.

I am trying to build Qt 5.2 as static with static OpenSSL on Windows.

我的最终目标是运送单个二进制文件,而无需提供libeay32.dll和ssleay32.dll.但是,在我看来这是不可能的.我用静态的openssl库构建了静态的Qt,但是Qt似乎完全忽略了提供的库,并且总是在搜索DLL.

My final goal is to ship a single binary without the need to provide libeay32.dll and ssleay32.dll with it. However, it seems to me that this is impossible. I built static Qt with static openssl libs but it seems like Qt is outright ignoring the libs provided and always searches for DLLs.

答案还表明QtNetwork始终搜索DLL并忽略所有内容否则,它还指出有两种选择将OpenSSL编译为Qt ...",但事实并非如此.

This answer also suggests that QtNetwork always searches for DLLs and ignores everything else but it also states that "two options are to compile OpenSSL into Qt..." but this does not seem to be the case.

有人可以提供明确的答案吗?

Can someone provide a definitive answer?

这是我的Qt配置(添加了换行符以提高可读性):

This is my Qt configure (line breaks added for readability):

configure -static -qmake -opensource -nomake examples -opengl desktop
-platform win32-msvc2010 -openssl -I C:\git\openssl\build\include
-L C:\git\openssl\build\lib OPENSSL_LIBS="-llibeay32 -lssleay32 -lgdi32"

推荐答案

是否可以使用静态OpenSSL构建静态Qt?

Is there any way to building static Qt with static OpenSSL?

当然,在配置Qt时需要使用以下选项:

Sure, you need to use the following option when configuring Qt:

-openssl-linked

原因是QtNetwork默认使用QLibrary类动态打开库以获取必要的符号.

The reason is that QtNetwork uses the QLibrary class by default for dynamically opening the library to get the necessary symbols.

这是告诉Qt不要这样做的选择,并遵守正常的链接规则.

This is the option to tell Qt not to do so, and respect the the normal linkage rules.

话虽如此,如果需要在没有您参与的情况下为最终用户提供安全更新,则不建议对openssl使用静态链接.考虑一下,如果您离开,不再从事该项目等等,会发生什么情况.

That being said, it is not recommended to use static linkage for openssl if security updates need to be available for the end user without your involvement. Consider that for a moment what happens if you are gone, not working on this project anymore, etc.

此设置也不经常测试,因此您实际上可能会遇到一些应在上游修复的问题,但这是有关用例的解决方案设计.

Also, this setup is not tested frequently, so you may actually encounter some issues that should be fixed upstream, but this is solution design for the use case in question.

免责声明:由于SO是关于编程的,所以我忽略了静态链接Againt Qt的许可后果,因此,我想迅速提醒您,请注意正确的用法,不要惹上法律麻烦.

Disclaimer: since SO is about programming, I am ignoring the licensing consequences for static linking againt Qt, so I would just like to quickly remind that you that be aware of the proper usage not to get into legal troubles.

这篇关于有什么方法可以使用静态OpenSSL构建静态Qt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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