Building Qt 5 for BlackBerry

This page provide instructions how to build Q5 for BlackBerry 10 and the Playbook OS. These instructions are intended for those who are going to contributre to Qt on BlackBerry 10 or like to experiment with Qt5 on BlackBerry 10. Please note that recent Qt5 snapshots are tailored to BlackBerry 10 and might not build or not run well on the PlayBook OS.

If you just plan to use Qt for application development for BlackBerry 10, you should strongly consider using QtCreator 2.7 and Qt 4.8.x provided in the BlackBerry 10 NDK, see this page for more details.

Setting up the environment

See Blackberry 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 modules separately. This is procedure is different with the builds for desktop platforms and allows to include only those modules which are relevant. Please adjust paths to suit your setup as needed.

So create a directory to hold the source code:

  1. $ cd $HOME/development
  2. $ mkdir qt5
  3. $ cd qt5

The repositories that we need are:

  1. qtbase
  2. qtjsbackend
  3. qtxmlpatterns (optional, provides support for XmlListModel in QtQuick)
  4. qtsensors (optional, provides access to the device’s sensors)
  5. qtmultimedia (optional, for audio and video playback)
  6. qtdeclarative
  7. qtgraphicaleffects (optional but nice for QtQuick2 special effects)
  8. qt3d (optional, provides 3D scenes using QML)
  9. qtscript (optional, only needed when using the qtquick1 module)

  1. $ git clone git://gitorious.org/qt/qtbase.git
  2. $ git clone git://gitorious.org/qt/qtjsbackend.git
  3. $ git clone git://gitorious.org/qt/qtxmlpatterns.git
  4. $ git clone git://gitorious.org/qt/qtdeclarative.git
  5. $ git clone git://gitorious.org/qt/qtsensors.git
  6. $ git clone git://gitorious.org/qt/qtmultimedia.git
  7. $ git clone git://gitorious.org/qt/qtgraphicaleffects.git
  8. $ git clone git://gitorious.org/qt/qt3d.git
  9. $ git clone git://gitorious.org/qt/qtquick1.git
  10. $ git clone git://gitorious.org/qt/qtscript.git

Building

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 $PATH to pickup tools and cross-compile tool-chain provided in the NDK.

Linux/OS X

First we need to configure Qt.

  1. $ cd qtbase
  2. $ ./configure -prefix $HOME/development/qnx/qt5 -xplatform blackberry-armv7le-qcc -opengl es2 -nomake docs -nomake examples -nomake demos -nomake tests  -opensource -confirm-license -release

Add

  1. -no-c++11
option when compiling on Mac OSX.

When compiling for the Playbook, use the following command:

  1. $ ./configure -prefix $HOME/development/qnx/qt5 -device blackberry-playbook-armv7le -opengl es2 -nomake docs -nomake examples -nomake demos -nomake tests  -opensource -confirm-license -release -no-neon

And afterwards we simply build it by calling make and make install.

  1. $ make -j<N>
  2. $ make install

where <N> is the number of parallel make jobs to run. This is often set to <No. of CPU cores + 1>.

Windows

  1. C:\dev> cd qtbase
  2. C:\dev\qtbase> configure -prefix C:\dev\qt5install -xplatform blackberry-armv7le-qcc -opengl es2 -nomake docs -nomake examples -nomake demos -nomake tests -opensource -confirm-license -release

For the Playbook:

  1. C:\dev> cd qtbase
  2. C:\dev\qtbase> configure -prefix C:\dev\qt5install -device blackberry-playbook-armv7le -opengl es2 -nomake docs -nomake examples -nomake demos -nomake tests -opensource -confirm-license -release -no-neon

If you want to work with HTTPS protocol, add -openssl option. need to check if the same required on Linux

Mac OS X

  1. $ cd qtbase
  2. $ ./configure -prefix $HOME/development/qnx/qt5 -xplatform blackberry-armv7le-qcc -opengl es2 -nomake docs -nomake examples -nomake demos -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 of your operating system.

You may now either move onto building your applications or continue here to install some additional modules to gain access to additional features of Qt5.

If you want to build additional modules, make sure to do this in the right order, because some modules depend on each other (qtjsbackend e.g. MUST be built in installed before qtdeclarative).

To build additional modules we need to use the qmake from our new Qt5 installation so we adjust the PATH environment variable accordingly:

Linux/OS X

  1. $ export PATH=$HOME/development/qnx/qt5/bin:$PATH

Windows

  1. C:\dev> set PATH=C:\dev\qt5install\bin;%PATH%

Now for each of the additional modules that you wish to build do the following:

Linux/OS X

  1. $ cd <modulename>
  2. $ qmake
  3. $ make -j<N>
  4. $ make install

Windows

  1. C:\dev> cd <modulename>
  2. C:\dev\module> qmake
  3. C:\dev\module> mingw32-make -j
  4. C:\dev\module> mingw32-make -j install

The following modules are known to build at the time of writing:

  • qtjsbackend (required for qtdeclarative)
  • qtxmlpatterns
  • qtdeclarative (required for qt3d)
  • qtgraphicaleffects
  • qt3d
  • qtscript (needed for QtQuick1)
  • qtquick1
  • qtsensors
  • qtmultimedia
  • qtwebkit, see Building QtWebKit for Blackberry

See also

Categories: