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

Mickey Shine picture Mickey Shine · Dec 2, 2010 · Viewed 8.5k times · Source

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

Answer

Darren Campbell picture Darren Campbell · Apr 24, 2013

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