Building Qt5 for BlackBerry
This page provides instructions on how to build Qt5 for BlackBerry 10 and the Playbook OS. These instructions are intended for those who are going to contribute to Qt on BlackBerry 10 or would like to experiment with Qt5 on BlackBerry 10 in general. Please note that the whole work is currently focused on Qt5 for BlackBerry 10. Qt5 might not build or not run well on the PlayBook OS.
Developers who do not know whether they need Qt 5 for their application to perform well, should strongly consider using QtCreator 2.8 or newer and Qt 4.8.x provided in the BlackBerry 10 NDK, see this page for more details. It’s perfectly possible to create a Qt5 based application and submit it for sale in BlackBerry World [blackberry.com] , although it is necessary to build the Qt5 libraries and provide them in the application package, since Qt5 is not yet included in the device firmware,.
Setting up the environment
See Setup for BlackBerry10 development for the introduction and further instructions.
Getting the source
The approach we will take is to do an in-source build of the Qt5 repositories that are needed but to install them to a custom directory ($HOME/development/qnx/qt5 in the following example). Please also note that we clone and build git submodules separately. This procedure is different to the builds for desktop platforms and allows to include only those submodules which are relevant. Please adjust the paths to suit your setup as needed.
First create a directory to hold the source code:
- cd $HOME/development
- mkdir qt5
- cd qt5
The following repositories are used in regular builds for BlackBerry 10 in BlackBerry’s public CI [qtlab.blackberry.com] as of Qt 5.2 Beta1 :
This matches all essential modules, plus several add-on modules. QtWebKit is currently not a part of the regular builds. Still, it is possible to build it, see Building QtWebKit for Blackberry
Other repositories known to build:
- qtjsbackend (not relevant anymore for Qt 5.2 and later)
- qt3d (optional, provides 3D scenes using QML)
- qtscript (optional, only needed when using the qtquick1 submodule)
- git clone git://gitorious.org/qt/qtbase.git
- git clone git://gitorious.org/qt/qtxmlpatterns.git
- git clone git://gitorious.org/qt/qtsensors.git
- git clone git://gitorious.org/qt/qtdeclarative.git
- git clone git://gitorious.org/qt/qtmultimedia.git
- git clone git://gitorious.org/qt/qtgraphicaleffects.git
- git clone git://gitorious.org/qt/qtconnectivity.git
- git clone git://gitorious.org/qt/qtquickcontrols.git
The process of building Qt5 for BlackBerry devices is very similar to building it for any other platform so it is worth having a quick read through the generic instructions for building Qt5 before proceeding.
Be sure that you have configured your environment to use the BlackBerry 10 NDK as described in Blackberry. This especially concerns setting the right values in $PATH to pickup tools and the cross-compile tool-chain provided in the NDK.
First we need to configure Qt.
The examples below show a minimal set of configure options. You can see the full set of configure options used in the BlackBerry’s public CI [qtlab.blackberry.com] in the raw console output of the
- cd qtbase
- ./configure -prefix $HOME/development/qnx/qt5 -xplatform blackberry-armle-v7-qcc -opengl es2 -nomake examples -nomake tests -opensource -confirm-license -release
When compiling for the Playbook, use the following command:
- ./configure -prefix $HOME/development/qnx/qt5 -device blackberry-playbook-armle-v7 -opengl es2 -nomake examples -nomake tests -opensource -confirm-license -release -no-neon
And afterwards we simply build it by calling make and make install.
- make -j<N>
- make install
where <N> is the number of parallel make jobs to run. This is often set to <No. of CPU cores + 1>.
- C:\dev> cd qtbase
- C:\dev\qtbase> configure -prefix C:\dev\qt5install -xplatform blackberry-armle-v7-qcc -opengl es2 -nomake examples -nomake tests -opensource -confirm-license -release
For the Playbook:
- C:\dev> cd qtbase
- C:\dev\qtbase> configure -prefix C:\dev\qt5install -device blackberry-playbook-armle-v7 -opengl es2 -nomake examples -nomake tests -opensource -confirm-license -release -no-neon
If you want to work with the HTTPS protocol, add -openssl option. need to check if the same is required on Linux
Mac OS X
This is almost the same as on Linux. We just add
- $ cd qtbase
- $ ./configure -prefix $HOME/development/qnx/qt5 -xplatform blackberry-armle-v7-qcc -opengl es2 -nomake examples -nomake tests -opensource -confirm-license -release -no-neon -no-c++11
After this process, you should have a basic Qt5 installation located in $HOME/development/qnx/qt5 or in C:\dev\qt5install, depending on your operating system.
You may now either move on to building your applications or continue here to install some additional git submodules to gain access to additional features of Qt5.
If you want to build additional git submodules, make sure to do this in the right order, because some git submodules depend on each other (qtjsbackend e.g. MUST be built and installed before qtdeclarative).
To build additional git submodules we need to use the qmake from our new Qt5 installation so we adjust the PATH environment variable accordingly:
- export PATH=$HOME/development/qnx/qt5/bin:$PATH
- C:\dev> set PATH=C:\dev\qt5install\bin;%PATH%
Now for each of the additional git submodules that you wish to build, do the following:
- cd <sub_module_name>
- make -j<N>
- make install
- C:\dev> cd <sub_module_name>
- C:\dev\submodule> qmake
- C:\dev\submodule> mingw32-make -j
- C:\dev\submodule> mingw32-make -j install
- Building Qt4 for Blackberry
- Building QtWebKit for Blackberry
- A HelloWorld using the Blackberry NDK CLI tools