Building QtWebKit on Windows

When I tried to build QtWebKit on Windows the first time, I realized it was a more complex task than on Linux. I experimented a lot to make building, testing and WebKit scripts work correctly. I decided that I would fix imperfect scripts and write a blogpost about this topic to relieve WebKit developers sufferings.

Previously build-webkit script was unable to create WebKitBuild\Release directory, developers had to create it manually. Additionally you had to copy jsc.exe from WebKitBuild\Release\JavaScriptCore\release\ to WebKitBuild\Release\JavaScriptCore\ for testing (run-sunspider, run-javascriptcore-tests), because these scripts determined the path of jsc.exe badly. Several scripts didn't work, because they used /dev/null as null device, but it didn't work on Windows. Invoking another perl script from a perl script didn't work. (eg. run-sunspider calls sunspider script) Several patches to fix these errors have been landed, and now it seems the build environment works correctly like on Linux.

If you would like to build QtWebKit on Windows, first of all you should download and install all necessary tools and libraries. WebKit needs bison, gperf, flex and libiconv. You can download them from GNUWin32 open source project:

If you have all the needed dependencies installed, you have to decide which compiler you would like to use. MinGW or MSVC? If you choose MSVC or MinGW-gcc-4.x, you have to build Qt from source. If you use MinGW-gcc-3.x, you don't have to build Qt, you can use the Qt binary package downloaded from QtSoftware, because Qt-4.5.3 binary is built with MinGW-gcc-3.x. It is very important to use that compiler for building WebKit which was used for building Qt, else you will get strange build error messages.

But you have to know, JavaScript execution will be 3-7x slower if you use MinGW-gcc-3.x, beacuse for some reason, JavaScriptCore's JIT support (Just In Time compilation) must be disabled with this version of gcc. Additionally WebKit doesn't support MinGW-3.x officially. Oliver Hunt, one of the core WebKit developers said: "... webkit requires gcc-4.x or higher to build ..." #28391. Qt guys told me, they would try to switch for MinGW-4.x when the newest Qt-4.6.0 would be released, but Qt 4.6.0 Beta is still built with minGW 3.4.

I have one more problem with MinGW-3.x. When I tried to build QtWebKit in debug mode, the linker ran out of memory when it linked QtLauncher.exe, because a Windows process can only use 2 Gbs of memory. This is one more reason for me not to use MinGW-3.x.

Runnig time with different JavaScript execution models

|-
Benchmark JIT Interpreter Slowdown
SunSpider 1262 ms 3819 ms 3.03x
V8 3668 ms 25848 ms 7.05x
WindScorpion 23975 ms 38405 ms 1.60x

Getting MinGW


Getting Qt


You can download Qt 4.5.3 from here

Building Qt with MinGW


In Qt source directory:
  • configure.exe -no-webkit
  • make
  • make install

Before building Qt and WebKit with MSVC


  • Follow instructions on this page ( Windows only point 2 )
  • Download WebKit Support Libraries from here to your WebKit directory
  • run "perl WebKit/WebKitTools/Scripts/update-webkit" script

Setting compiler environment for building with MSVC


  • Start menu/Microsoft Platform SDK for Windows Server 2003 R2/Open Build Environment Window/Windows XP 32-bit build environment/Set Windows XP 32-bit build environment (Retail)
  • execute in this terminal the batch file can be found Start menu/Visual C++ 2005 Express Edition/Visual Studio Tools/Visual Studio 2005 Command Prompt.lnk (Here is "c:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat")

Building Qt with MSVC


Setting environment:
  • Set compiler environment

Building:

  • Change directory into Qt source
  • configure.exe
  • nmake

Building WebKit with MSVC


Setting environment:
  • Set compiler environment
  • Add bin directory of GNUWin32 tools to path
  • Add bin directory of perl to path
  • Add bin directory of Qt to path
  • Set QTDIR environment variable pointing to Qt directory
  • Change directory into WebKit source dir

Building:

  • perl WebKitTools\Scripts\build-webkit

Building WebKit with MinGW


Setting environment:
  • Add bin directory of MinGW to path
  • Add bin directory of GNUWin32 tools to path
  • Add bin directory of perl to path
  • Add bin directory of Qt to path
  • Set QTDIR environment variable pointing to Qt directory

Building:

  • perl WebKitTools\Scripts\build-webkit

Testing JavaScriptCore


  • Set environments
  • perl WebKitTools\Scripts\run-jsc
  • perl WebKitTools\Scripts\run-javascriptcore-test
  • perl WebKitTools\Scripts\run-sunspider
  • perl WebKitTools\Scripts\sunspider-compare-results

Anonymous (not verified) - 04/12/2010 - 18:45

Hello,

I would like to know if you have an inplementation of qtWebkit JIT For wince.

Thanks,

Best Regards

Leonardo

akos.kiss - 04/27/2010 - 18:22

We did not try our JIT on WinCE. Yet.

Anonymous (not verified) - 08/22/2011 - 07:26

Can we build webkit with v8 library?

Peter Varga (not verified) - 08/22/2011 - 09:37

Currently we can't. I have detailed the problem in this thread: https://lists.webkit.org/pipermail/webkit-qt/2011-August/001762.html

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • No HTML tags allowed
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Fill in the blank