Coding with Titans

so breaking things happens constantly, but never on purpose

Qt-4.8 compilation for PlayBook

Although the PlayBook tablet was totally abandoned by BlackBerry long time ago and there are other problems around the company I still wish them well. That’s why I continuously support the BlackBerry Native Development plugin for Visual Studio. Recent additions were about Visual Studio 2015 RC and most notably PlayBook and Qt-4.8.3 support. I hope it will inspire you and myself to write some applications on it.

Thankfully lack of support from BlackBerry is the best thing they could do to PlayBook. It’s OS software is not bloated with useless features and even if you count it to be 4-years-old tablet with only 1GHz clock and 1GB of RAM applications run fast and fluid. Most notably it’s now so damn cheap to buy, if you plan to do some IoT, that it compares with Raspberry Pi 2 and has SD and screen already attached.

The problem however is lack of a common UI framework that could work out-of-the-box. Until now. BlackBerry tried to support few approaches to enable developers. One was Adobe Air, but somehow I am not so keen to port anything to ActionScript. Another one was Android Runtime to let do some Java programming. This was better, but the best option to me appeared their involvement in Qt framework (and more here). This allows going down to the bare C/C++ coding for maximum efficiency etc. Officially the last version dedicated to PlayBook was Qt-4.8.3. Unfortunately it was never published and never integrated with any IDE. They probably moved all forces to support upcoming BB10 platform at that time.

If you look closely on PlayBook NDK 2.1 you will find some Qt libraries in it, but they don’t tend to work (maybe because the lack of platform-specific libblackberry.so included?). There is even officially published guide, how to build it from sources on Linux machine. I however learnt more from improved versions created by community around how to integrate it with Momentics (more here) and build and tried it several times on my own. As a result I even prepared my own guide, how to build it on Windows. But please, being serious, who wants to do that before writing application? Answer is obvious – no one. There should be no barrier like that and if you count them all, you will know, why BlackBerry failed in the Mobile World War. I always say – small things to matter.

TL;DR

What I really did? I enabled basic Qt types of project via BlackBerry Native Development plugin inside Visual Studio. There are 2 simple steps (assuming you have the plugin configured and NDK 2.1 installed), but I will work on improving it and making down to 1:

  1. Create new project in Visual Studio 2013: File –> New –> Project… –> BlackBerry Projects –> Qt –> PlayBook Qt4 Core Application

    QtProject

  2. make sure following NuGet packages are installed:

Are there any issues?

Sure they are:

  • First and the biggest is that all .moc files have to be created manually (tools for Windows available here). I am working on another NuGet package that will fix it, but it’s not finished yet.
  • Compilation might generate lots of warnings like: “warning : the mangling of ‘va_list’ has changed in GCC 4.4”. This can be disabled by adding this switch “-Wno-psabi” for the compiler (Project properties –> C/C++ –> Command Line –> Additional Options).
  • The final .bar file deployed for device can be quite big (~20MB at startup) as all required Qt libraries need to be included. There is a workaround to put them once to the user’s home folder, when doing development and skip placing them in a .bar file for that time, but haven’t verified it yet.

Post scriptum

This whole project started mostly as a result of my IoT midnight plays and lack of real file manager for PlayBook. Thankfully I found very old project from Kevin Boone named kfile. He also created an introduction, how to make Qt apps on PlayBook and was so kind to share sources. I test the NuGet packages and Visual Studio plugin against this code and plan to publish it in AppWorld shortly.