A Week of Compiling

Jeff Tranter

Jeff Tranter

Jeff Tranter is a Qt Consulting Manager at ICS. Jeff oversees the architectural and high-level design of software systems for clients. Jeff’s leadership organizes global teams of developers on desktop and embedded applications.

By Jeff Tranter | Friday, December 30, 2011

This week was a little slow as some people were away for the holidays. The new callback-qtimplementation by Viras got committed to github and we are now working with that version.

Much of the week has been spent building Qt5. The source code for Qt5 is huge - several gigabytes. It takes considerable time to check out the code even with a fast Internet connection. Some reasons for this are the size of Webkit, all of the new modules, mobility functions, unit tests, and the files related to git. There are some good instructions for building Qt5 here.

The version of WebKit in Qt5 git is rather old and for this project we want the latest WebKit 2 to pick up all the recent changes for performance and HTML5 support. We built the latest QtWebkit version from git using the instructions here. This is also a very big git checkout and takes some time to build.

Once we had Qt5 built with WebKit support, we looked at what was needed to compile the current callback-qt code with Qt5. Most of the changes needed are quite straightforward. Qt5 has moved what was Qt Mobility into Qt modules such as "location", "feedback", and "systeminfo". In fact the QWidgets are now an optional module "widgets" that you need to enable in your qmake project file. Some class names have changed in Qt5. For example, QSystemNetworkInfo is now QNetworkInfo and QSystemDeviceInfo is now QDeviceInfo. We now have an initial set of patches that allow callback-qt to compile with Qt5 as well as Qt4, in some cases using #if directives in the code to handle the differences. With these changes the sample Qt PhoneGap HTML5 application is working with Qt5.

The Qt Simulator is very useful for this type of project as it allows you to simulate most of the phone hardware like GPS, battery, camera, sensors, etc. when running on a desktop. Unfortunately it looks like a significant amount of work is needed to port the simulator and the other components it uses to Qt5. It is not clear yet when this will be ready.

We plan to move on to implementing some of the missing PhoneGap modules. I've summarized them on the wiki page. The Accelerometer and Compass modules look like good candidates for us to start on as they are quite small and map well to functions in Qt, so we plan to start on those next week (or should I say next year?).




Making this work with Qt5/WebKit2 is not straight-forward at all, thus you must be using the QWidget based WebKit API and not the Qt Quick WebKit2 API currently in trunk.

The former is a legacy API in Qt5 and it will only be supported on desktop systems, thus not on mobile devices such as the N9.

You should join #qtwebkit on freenode and subscribe to our mailing lists.

I suggest talking with cmarcelo as he has given a lot of thought on how to accomplish some kind of hybrid support for WebKit2 which is a split process engine. The UI process talks to the web process using IPC, making a direct JS/C++ bridge impossible, though it should be possible to create a plugin for the web process (API doesn't exists for that at the moment) and communicate with the plugin via IPC.



For building Qt5 for WebKit trunk, please use these scripts which uses pinned/tested versions of Qt5.