Building Qt 5 for BlackBerry 10

Setting up the Environment

See Setup for BlackBerry 10 development for the introduction and further instructions.

Getting the Source

The approach we will take is to do an in-source build of the Qt 5 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:

  • qtbase
  • qtxmlpatterns
  • qtsensors
  • qtdeclarative
  • qtmultimedia
  • qtgraphicaleffects
  • qtconnectivity
  • qtquickcontrols

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:

  • qt3d (optional, provides 3D scenes using QML)
  • qtscript (optional, only needed when using the qtquick1 submodule)
  • qtlocation

Then clone:

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

Building qtbase

The process of building Qt 5 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 Qt 5 before proceeding.

Be sure that you have configured your environment to use the BlackBerry 10 NDK (source the bbndk script on Linux for instance). This especially concerns setting the right values in $PATH to pickup tools and the cross-compile tool-chain provided in the NDK.

Linux and OS X

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 in the raw console output of the qtbase build. See this link and then open the raw Console Output for the last successful build for ARM or for x86.

cd qtbase
./configure -prefix $HOME/development/qnx/qt5 -xplatform blackberry-armle-v7-qcc -opengl es2 -nomake examples -nomake tests  -opensource -confirm-license -release

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>.

Windows

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

If you want to work with the HTTPS protocol, add the -openssl option.

OS X

This is almost the same as on Linux:

$ 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

After this process, you should have a basic Qt 5 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 Qt 5.

Building Other Modules

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.

To build additional git submodules we need to use the qmake from our new Qt 5 installation so we adjust the PATH environment variable accordingly:

Linux and OS X: export PATH=$HOME/development/qnx/qt5/bin:$PATH

Windows: 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:

Linux and OS X

cd <sub_module_name>
qmake
make -j<N>
make install

Windows

C:\dev> cd <sub_module_name>
C:\dev\submodule> qmake
C:\dev\submodule> mingw32-make -j
C:\dev\submodule> mingw32-make -j install

© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.