Sunday, 11 July 2010

Building QtWebKit on Windows

Intention of this and the following blog entries is to record my experiences while building QtWebKit on Windows with MS Visual Studio 2008. I’ve tried to gather few common issues and solutions for them which I came across in the process of compilation.

Which compiler?

I opted for Microsoft Visual Studio 2008 as I had it already installed on my laptop.

However, QtWebKit building instructions indicate that we can use either MSVS or MinGW.

Note that, rest of this article only talks about using MS Visual Studio (nmake) as the compiler. If you are willing to choose MinGW, please follow instructions here.

Windows Platform SDK

Download and install Windows Platform SDK. Make sure INCLUDE env variable has the SDK include path:

ex : C:\Program Files\Microsoft SDKs\Windows\v6.0\Include

and LIB env variable includes SDK lib path.

ex : C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib

Active Perl v5.10

Install Active Perl later than v5.10 from here. Ensure PATH variable includes:

C:\Perl\bin;C:\Perl\site\bin

Qt for Windows SDK

Download and install latest available Qt for windows from http://qt.nokia.com/downloads. Qt can either be downloaded as an SDK or as precompiled binary set.

When I downloaded SDK, I noticed that the SDK binaries were compiled with MinGW. This means, its incompatible with my MSVC compiler. So, I had to rebuild Qt source from scratch after installing Qt SDK.

As an alternative to this approach, we can download and install Qt binaries which are precompiled with MSVC.

Luckily Qt provides prebuilt binaries compiled with both MinGW and MSVC-2008. You can choose either of that, based on the compiler you are using.

Ensure QTDIR env variable is created and pointing to Qt install folder.

ex : QTDIR=C:\Qt\4.6.3

Also, PATH variable need to include the Qt binary path:

C:\Qt\4.6.3\bin

GNUWin32 tools

Download and install following GNUWin32 tools :

Include install path under PATH env variable (ex: C:\GnuWin32\bin)

Checking out WebKit source

Check out source from WebKit SVN trunk http://svn.webkit.org/repository/webkit/trunk

I experienced a glitch while checking out webkit repository. Have a look at my previous blog entry for more info on that.

Building QtWebkit

Now, we are ready with all the pre-requisites. To build QtWebKit, we need to run build-webkit script passing –-qt and -–debug or --release parameters.

Following script execution builds the release version of QtWebKit binaries:

perl WebKitTools\Scripts\build-webkit --qt --release

for debug version of binaries :

perl WebKitTools\Scripts\build-webkit --qt --debug

References

http://trac.webkit.org/wiki/BuildingOnWindows
http://trac.webkit.org/wiki/BuildingQtOnWindows
http://webkit.sed.hu/blog/20091027/building-qtwebkit-windows
http://webkit.org/building/build.html
http://webkit.org/building/tools.html

3 comments:

Guru Prasath said...

A nice post. Are you a C++ programmer/expert?

Rajesh said...

Hi Prashanth,
I have followed the steps given by you.
I am getting the following.

*************

C:\webkit>perl WebKitTools\Scripts\build-webkit --qt --release
0 byte sized file removed from build directory: C:\webkitdist/Release
'qmake' is not recognized as an internal or external command,
operable program or batch file.
Generating derived sources

Calling 'qmake -r OUTPUT_DIR=C:\webkitdist/Release -r C:/webkit/DerivedSources.p
ro -o Makefile.DerivedSources' in C:\webkitdist\Release

'qmake' is not recognized as an internal or external command,
operable program or batch file.
Failed while running qmake to generate derived sources!

***********

I have followed many blogs & steps, but i couldn't succeed building webkit.

Please help me.

Thanks in Advance,
Rajesh

Prashanth Narayanaswamy said...

@rajesh make sure you have qmake install folder path set in PATH environmental variable.