Sunday, 11 July 2010

Building QtWebKit on Windows – Few common issues

In continuation to my last blog entry, here I’m trying to capture few common problems that I encountered along with possible solutions for them, in the process of building QtWebKit for windows.

Listing out issues and followed by possible solution for them:

1. ERROR: qmake missing but required to build WebKit.

Make sure QTDIR env variable is set and PATH variable includes path to Qt bin folder.

set QTDIR=C:\Qt\4.6.3

set PATH=%PATH%;%QTDIR%\bin;

2. ERROR: flex, bison, gperf missing but required to build WebKit.

Have you installed GNUWin32 tools? Also, include GNUWin32 bin path under PATH env variable.

set PATH=%PATH%;C:\GnuWin32\bin;

3. 'nmake' is not recognized as an internal or external command

Make sure you have installed MS Visual Studio. Also try running the webkit build script from within Visual Studio 2008 Command Prompt.

4. Failed to generate WebCore's derived sources!Can't locate Switch.pm in @INC

Is Active Perl installed? Active Perl v5.10 or higher is required. Update PATH env variable with perl bin folder paths.

set PATH=C:\Perl\site\bin;C:\Perl\bin;%PATH%

5. Cannot open include file: 'windows.h': No such file or directory

Microsoft Platform SDK need to be installed. INCLUDE and LIB env variables need to be updated.

set INCLUDE=%INCLUDE%;C:\Program Files\Microsoft SDKs\Windows\v6.0\Include

set LIB=%LIB%;C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib

6. JavaScriptCore\DerivedSources\chartables.c (13) : error C2466: cannot allocate an array of constant size 0

This issue arises because of usage of wrong version of perl to generate derived sources.

To solve this issue, we need to install Active Perl v5.10 and regenerate derived sources. For regenerating the derived sources, delete the ‘WebKitBuild’ folder and restart the build by launching the ‘build-webkit’ script again.

7. LINK : fatal error LNK1210: exceeded internal ILK size limit; link with /INCREMENTAL:NO

Not sure why visual studio crib with such a linker error. As a quick solution, we need to disable incremental linking.

Update webkit.pri by adding linker flag to disable incremental linking:

QMAKE_LFLAGS += /INCREMENTAL:NO

Restart the build by launching the ‘build-webkit’ script again.

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

Sunday, 4 July 2010

Excluding folders while checking out an SVN repository

Blogging this entry out of frustration of not finding an easier way to exclude selected folders while ‘svn checkout’ing a huge svn repository.

I had to checkout all folders from webkit trunk repository except this folder – LayoutTests, which was not really necessary for my work. I was not interested in downloading it, as it was really huge and could consume lots of time and bandwidth in downloading it.

Unfortunately ‘svn:ignore’ couldn’t helped me in achieving this as I was thinking earlier :(. ‘svn:ignore’ is meant only for ignoring files/folders while committing/adding them to repository, but not for checking out or updating a repository.

After googling for a while came to know that only way of achieving this is to use Sparse Checkouts feature which was introduced since SVN v1.5.

However, solution is not straight forward. we have to checkout with an option of --depth=immediates which would checkout all files and folders (excluding everything from sub-folders). Then ‘svn up’ individual folder which we are interested in.

I was really not satisfied by this solution. This doesn’t help much in addressing the problem if we do have large number of folders and are in different levels in folder hierarchy.

Can this be a new feature for svn toolset? or do any one have a better approach for this problem? Let me know.

Sunday, 17 January 2010

Swap space on Ubuntu

Had to compile Qt on Ubuntu virtual machine running on Win XP. Compilation used to fail repeatedly for QtGui component with the following error:

collect2: ld terminated with signal 9 [Killed]

With not much error information, I was clueless on what was going wrong!

Google’ing this error resulted me to learn that swap space reserved was too less (or not at all reserved?) which was required for Qt compilation.

Then tried using the swapon utility command to check how much swap space is already reserved:

sudo swapon –s

Found that nothing was listed at all!

Executed the following commands to create a swap space of 512MB.

sudo dd if=/dev/zero of=/mnt/512Mb.swap bs=1M count=512
sudo mkswap /mnt/512Mb.swap
sudo swapon /mnt/512Mb.swap

This reserved 512MB of swap space, which solved my Qt compilation issues.

reference : https://help.ubuntu.com/community/SwapFaq

Saturday, 17 October 2009

Developing Applications with Nokia WRT - VTU EduSat ppt

Check out this SlideShare Presentation on Developing Applications with Nokia Web Runtime.
This was broadcasted live to all VTU colleges in Karnataka on 14th Sept 2009 as part of VTU's EDUSAT programme.

My self and Raghava had an opportunity to represent Nokia's Web Runtime.
We tried to present the latest developments in Nokia's WebRuntime.


Sunday, 6 September 2009

Dependency Walker for Windows binaries

I find Dependency Walker a very useful utility. This helps us to scan any of windows binaries (exe, dll ...).

It can dissect almost any type of windows binary file, to show up all possible details hidden within.

Listing few of the details this utility can provide,

  • Basic binary properties Ex: physical path, version info, etc.
  • Exported functions with their signatures and ordinal numbers.
  • Recursive list of dependent libraries and their details.

It didn’t took much time for me to discover the power of this tiny tool which is distributed as apart of MS Visual Studio Tools. This can also be downloaded for free at http://www.dependencywalker.com/.

Below is one of such situation, where this tool helped me to rapidly identify and debug the problem.

I was building Qt for Win with ‘-openssl-linked’ option and this required me to download the openSSL libraries separately. I had downloaded and copied ‘libeay32.dll’ under Qt’s bin folder.

Even though Qt compiled without any problems, I had issues with launching few of the processes which had dependency over libeay32.dll. For some reasons, loader started complaining about missing ordinal in libeay32.dll.

Dependency walker came into rescue. I simply loaded the failing process into DependencyWalker and it listed all dependent DLLs with respective details. I could just walk to the libeay32.dll and examine its version.

There you go! It was loading an older version of DLL which had been installed as part of Wireless monitor app. Since PATH variable had the wireless app’s path occurring before Qt’s bin path, it was always picking the older DLL from wrong location which caused the issue.

It hardly took me few minutes to identify and fix the issue.

Hope this is useful :)

Thursday, 13 August 2009

HTML5 video

Just wanted to embed a video using HTML5 video feature.  The source looks very simple!

<video controls="controls" src="http://tinyvid.tv/file/3ifyc1xrvwkjr.ogg" tabindex="0">
   <p>
   Sorry, your browser doesn't support the <video> element. You'll need a browser that can playback Ogg media using HTML5 video and audio tags.
   </p>
</video>

This tries to embed one of my favorite music video – In the Shadows by The Rasmus :)

Please use the latest versions of Chrome or Firefox to experience the embedded video. The latest versions of Chrome and Firefox are already supporting the HTML5 video and audio features.

Have fun!

Reference : HTML5 spec