是否可以在启用 webkit 的情况下构建静态 Qt 库?又如何呢?
我尝试使用以下命令构建静态 Qt 库:
./configure --prefix=/usr/local/qt --static --accessibility --multimedia --audio-backend --svg --webkit --javascript-jit --script --scripttools --declarative --dbus --debug
但我收到一条消息:
WARNING: Using static linking will disable the WebKit module.
是否可以在启用所有模块的情况下构建静态 Qt 库?又如何呢?
谢谢
I tried to build static Qt library with the following command:
./configure --prefix=/usr/local/qt --static --accessibility --multimedia --audio-backend --svg --webkit --javascript-jit --script --scripttools --declarative --dbus --debug
But I got a message said:
WARNING: Using static linking will disable the WebKit module.
Is that possible to build static Qt library with all modules enabled? and how?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
对于 Qt 4.8.3,我必须修补 .pro 文件以制作单个 QtWebKit,而不是单独的 WebKit 和 JavaScriptCore 库。链接器会感到困惑,因为两个库之间存在相互依赖关系。
不确定类似的方法是否适用于您的 Qt 4.7.1。
我不会提及许可问题。
For Qt 4.8.3 I had to patch the .pro files to make a single QtWebKit instead of separate WebKit and JavaScriptCore libraries. The linker gets confused because there are inter-dependencies between the two libraries.
Not sure if a similar approach will work for your Qt 4.7.1.
I'm not going to mention the licensing issues.
几乎不可能。 Webkit 使用独立的 makefile,而不是由配置工具生成的 makefile。您可以自行查看
src\3rdparty\webkit\source
。如果您尝试使用 webkit 静态编译 Qt,您将遇到一条错误,指出无法找到 -lwebcore。事实上,webcore.a 是在 src\3rdparty\webkit\source\webcore\release 生成的,-ljscore 也是如此。但如果你自己将它们复制到/lib,总是会弹出链接错误。
我尝试编辑 webcore 和 jscore 的 makefile 添加
-static
,但它根本不起作用。可悲的是,这就是我现在所得到的一切。
Almost impossible. Webkit uses stand along makefiles other than the makefiles generated by configure tool. You can check
src\3rdparty\webkit\source
yourself.If you tried to compile Qt static with webkit, you'll meet a error says cannot find -lwebcore. In fact, the webcore.a is generated at
src\3rdparty\webkit\source\webcore\release
, so does -ljscore. But if you copy them to /lib yourslef, link error always popup.I've tried to edit makefiles of webcore and jscore adding
-static
, but it didn't work at all.Sadly, that's all what I got now.
与 LGPL 问题无关,因为您的应用程序可以是开源的,并以与 LGPL 兼容的方式获得许可。
显然,由于技术原因,静态链接的 WebKit 不受支持。 (有些编译器似乎对此不满意)。构建脚本已在提交 4221d629e2cf37ee8c5ba7cb595b05ab8c82f113 中更新以明确阻止它:
https://www.qt.gitorious.org/qt/qt/commit/4221d629e2cf37ee8c5ba7cb595b05ab8c 82f113
它可能适用于您的编译器,也可能不适用于您的编译器,但我怀疑 Qt 团队不想为所有官方支持的架构维护它。
Nothing to do with LGPL issues, since your app could be open source and licensed in a way that would be compatible with the LGPL.
Apparently statically linked WebKit is unsupported for technical reasons. (Some compilers seem to not be happy with it). The build script has been updated in commit 4221d629e2cf37ee8c5ba7cb595b05ab8c82f113 to explicitly prevent it:
https://www.qt.gitorious.org/qt/qt/commit/4221d629e2cf37ee8c5ba7cb595b05ab8c82f113
It may or may not work with your compiler, but I suspect the Qt team didn't want to go into the trouble of maintaining that for all the officially supported architectures.
好吧,Lou Franco 是对的,使用 LGPL 并静态编译并不真正符合 LGPL。大多数 Qt“用户”或开发人员所做的是动态编译,在应用程序目录中提供他们“自己编译的”库。只要您没有更改 Qt / QtWebKit / WebKit 本身中的任何代码并且没有向上游提供更改,那么这对于 LGPL 来说是可以的。
Well, Lou Franco is right, using the LGPL and compiling statically does not really comply the LGPL. What most Qt "users" or developers do is, to compile dynamically, prividing their "own compiled" libraries in the application directory. This is okay with the LGPL as long as you did not change any code in Qt / QtWebKit / WebKit itself and did not provide the changes to upstream.
可能是因为它的一部分是 LGPL。因此,这可能是可能的,但 LGPL 意味着您必须提供源代码或编译的目标代码,以便最终用户可以根据自己的版本重新链接。
如果您不打算将结果部署给任何人,那么您可能可以这样做并遵守。
不过,您必须编辑构建才能实际执行此操作,因为它们看起来默认符合 LGPL。
Might be because parts of it are LGPL. So, it's probably possible, but the LGPL would mean that you have to provide source or compiled object code so that an end-user could relink against their own version.
If you are not deploying the result to anyone, then you could probably do it and comply.
You'll have to edit the build to actually do it though, since it looks like they comply with LGPL by default.