是否可以在启用 webkit 的情况下构建静态 Qt 库?又如何呢?

发布于 2024-10-05 16:51:10 字数 381 浏览 6 评论 0原文

我尝试使用以下命令构建静态 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

陌路黄昏 2024-10-12 16:51:10

对于 Qt 4.8.3,我必须修补 .pro 文件以制作单个 QtWebKit,而不是单独的 WebKit 和 JavaScriptCore 库。链接器会感到困惑,因为两个库之间存在相互依赖关系。

不确定类似的方法是否适用于您的 Qt 4.7.1。

我不会提及许可问题。

diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf
index d60533e..6a7ffa7 100644
--- a/mkspecs/common/linux.conf
+++ b/mkspecs/common/linux.conf
@@ -7,8 +7,8 @@ QMAKE_CXXFLAGS_THREAD   += $QMAKE_CFLAGS_THREAD

 QMAKE_INCDIR          =
 QMAKE_LIBDIR          =
-QMAKE_INCDIR_X11      = /usr/X11R6/include
-QMAKE_LIBDIR_X11      = /usr/X11R6/lib
+QMAKE_INCDIR_X11      = /usr/include/X11
+QMAKE_LIBDIR_X11      = /usr/lib/X11
 QMAKE_INCDIR_QT       = $[QT_INSTALL_HEADERS]
 QMAKE_LIBDIR_QT       = $[QT_INSTALL_LIBS]
 QMAKE_INCDIR_OPENGL   = /usr/X11R6/include
diff --git a/mkspecs/linux-g++-64/qmake.conf b/mkspecs/linux-g++-64/qmake.conf
index 222f6b7..3780295 100644
--- a/mkspecs/linux-g++-64/qmake.conf
+++ b/mkspecs/linux-g++-64/qmake.conf
@@ -20,7 +20,7 @@ include(../common/gcc-base-unix.conf)
 include(../common/g++-unix.conf)


-QMAKE_LIBDIR_X11      = /usr/X11R6/lib64
-QMAKE_LIBDIR_OPENGL   = /usr/X11R6/lib64
+QMAKE_LIBDIR_X11      = /usr/lib/X11
+QMAKE_LIBDIR_OPENGL   = /usr/lib/X11

 load(qt_config)
diff --git a/src/3rdparty/webkit/Source/WebKit.pro b/src/3rdparty/webkit/Source/WebKit.pro
index 9be0f4a..c1e575d 100644
--- a/src/3rdparty/webkit/Source/WebKit.pro
+++ b/src/3rdparty/webkit/Source/WebKit.pro
@@ -3,14 +3,9 @@ CONFIG += ordered

 include(WebKit.pri)

-!v8 {
-    exists($PWD/JavaScriptCore/JavaScriptCore.pro): SUBDIRS += JavaScriptCore/JavaScriptCore.pro
-    exists($PWD/JavaScriptCore/jsc.pro): SUBDIRS += JavaScriptCore/jsc.pro
-}

 webkit2:exists($PWD/WebKit2/WebKit2.pro): SUBDIRS += WebKit2/WebKit2.pro

-SUBDIRS += WebCore
 SUBDIRS += WebKit/qt/QtWebKit.pro

 webkit2 {
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro b/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro
index 847f6f4..e2daf24 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro
+++ b/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro
@@ -2,7 +2,6 @@
 CONFIG += building-libs
 CONFIG += depend_includepath

-TARGET = QtWebKit
 TEMPLATE = lib

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.

diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf
index d60533e..6a7ffa7 100644
--- a/mkspecs/common/linux.conf
+++ b/mkspecs/common/linux.conf
@@ -7,8 +7,8 @@ QMAKE_CXXFLAGS_THREAD   += $QMAKE_CFLAGS_THREAD

 QMAKE_INCDIR          =
 QMAKE_LIBDIR          =
-QMAKE_INCDIR_X11      = /usr/X11R6/include
-QMAKE_LIBDIR_X11      = /usr/X11R6/lib
+QMAKE_INCDIR_X11      = /usr/include/X11
+QMAKE_LIBDIR_X11      = /usr/lib/X11
 QMAKE_INCDIR_QT       = $[QT_INSTALL_HEADERS]
 QMAKE_LIBDIR_QT       = $[QT_INSTALL_LIBS]
 QMAKE_INCDIR_OPENGL   = /usr/X11R6/include
diff --git a/mkspecs/linux-g++-64/qmake.conf b/mkspecs/linux-g++-64/qmake.conf
index 222f6b7..3780295 100644
--- a/mkspecs/linux-g++-64/qmake.conf
+++ b/mkspecs/linux-g++-64/qmake.conf
@@ -20,7 +20,7 @@ include(../common/gcc-base-unix.conf)
 include(../common/g++-unix.conf)


-QMAKE_LIBDIR_X11      = /usr/X11R6/lib64
-QMAKE_LIBDIR_OPENGL   = /usr/X11R6/lib64
+QMAKE_LIBDIR_X11      = /usr/lib/X11
+QMAKE_LIBDIR_OPENGL   = /usr/lib/X11

 load(qt_config)
diff --git a/src/3rdparty/webkit/Source/WebKit.pro b/src/3rdparty/webkit/Source/WebKit.pro
index 9be0f4a..c1e575d 100644
--- a/src/3rdparty/webkit/Source/WebKit.pro
+++ b/src/3rdparty/webkit/Source/WebKit.pro
@@ -3,14 +3,9 @@ CONFIG += ordered

 include(WebKit.pri)

-!v8 {
-    exists($PWD/JavaScriptCore/JavaScriptCore.pro): SUBDIRS += JavaScriptCore/JavaScriptCore.pro
-    exists($PWD/JavaScriptCore/jsc.pro): SUBDIRS += JavaScriptCore/jsc.pro
-}

 webkit2:exists($PWD/WebKit2/WebKit2.pro): SUBDIRS += WebKit2/WebKit2.pro

-SUBDIRS += WebCore
 SUBDIRS += WebKit/qt/QtWebKit.pro

 webkit2 {
diff --git a/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro b/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro
index 847f6f4..e2daf24 100644
--- a/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro
+++ b/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro
@@ -2,7 +2,6 @@
 CONFIG += building-libs
 CONFIG += depend_includepath

-TARGET = QtWebKit
 TEMPLATE = lib
蓝眼睛不忧郁 2024-10-12 16:51:10

几乎不可能。 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.

黯然 2024-10-12 16:51:10

与 LGPL 问题无关,因为您的应用程序可以是开源的,并以与 LGPL 兼容的方式获得许可。

显然,由于技术原因,静态链接的 WebKit 不受支持。 (有些编译器似乎对此不满意)。构建脚本已在提交 4221d629e2cf37ee8c5ba7cb595b05ab8c82f113 中更新以明确阻止它:

删除了对 QtWebKit 静态链接的支持。
Qt 4.7 中将不再支持 WebKit 的静态链接,因此此提交确保文档中提到它,并且如果请求 Qt 的静态链接,配置将禁用 WebKit。

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:

Removed support for static linking of QtWebKit.
Static linking of WebKit is not going to be supported anymore in Qt 4.7, so this commit makes sure it's mentioned in the documentation and that configure disables WebKit if static linking of Qt is requested.

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.

倦话 2024-10-12 16:51:10

好吧,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.

暮年慕年 2024-10-12 16:51:10

可能是因为它的一部分是 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文