Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is that possible to build static Qt library with webkit enabled? And how?

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

like image 531
Mickey Shine Avatar asked Dec 02 '10 01:12

Mickey Shine


2 Answers

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
like image 128
Darren Campbell Avatar answered Nov 15 '22 20:11

Darren Campbell


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.

like image 36
liuyanghejerry Avatar answered Nov 15 '22 20:11

liuyanghejerry