Building Qt 5 for BlackBerry: Difference between revisions
Micke.prag (talk | contribs) m (Source code has been moved from gitorious) |
m (JKSH moved page Building Qt5 for Blackberry to Building Qt 5 for BlackBerry: Title format) |
Revision as of 12:28, 25 August 2015
This page provides instructions on how to build Qt5 for BlackBerry 10 and the Playbook OS. Please note that the work is currently focused on Qt5 for BlackBerry 10. Qt5 might not build or not run well on the PlayBook OS, whereas Qt v5.1.1 is known to build and work with some potential issues when executing an application on Playbook.
Setting up the environment
See Setup for Blackberry10 development for the introduction and further instructions.
Getting the source
We do an in-source build of the Qt5 repositories that are needed and install them into dedicated build directory.
$HOME/development/qnx/qt5
is used in the examples below. 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 without managing a master repository. 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 as of Qt 5.2 :
- qtbase
- qtdeclarative
- qtmultimedia
- qtgraphicaleffects
- qtconnectivity
- qtxmlpatterns
- qtsensors
- 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:
- 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)
- qtlocation
Then clone:
git clone git://code.qt.io/qt/qtbase.git
git clone git://code.qt.io/qt/qtxmlpatterns.git
git clone git://code.qt.io/qt/qtsensors.git
git clone git://code.qt.io/qt/qtdeclarative.git
git clone git://code.qt.io/qt/qtmultimedia.git
git clone git://code.qt.io/qt/qtgraphicaleffects.git
git clone git://code.qt.io/qt/qtconnectivity.git
git clone git://code.qt.io/qt/qtquickcontrols.git
Using the master repository
The presented approach handles repositories from related Qt5 modules separately. If you prefer, you can also adapt the standard procedure based on a build from the master repository. You just need to make sure that your master repository has been initialized for those repositories which are actually supported on BlackBerry 10. The following can be used to initialize the master repository for the Qt modules out lined above:
./init-repository -f —no-webkit —module-subset=qtbase,qtxmlpatterns,qtdeclarative,qtsensors,qtmultimedia,
qtgraphicaleffects,qtconnectivity,qtquickcontrols,qtlocation
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 in $PATH to pickup tools and the cross-compile tool-chain provided in the NDK.
Note
When building Qt5 with the latest public NDK some features might be disabled (Input Method Framework, LGMON, NFC Share). This is due to missing header files which have not been published yet.
The "configure" step
First we need to configure Qt.
Linux/OS X
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
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. Usually, this is set to <No. of CPU cores + 1>.
Windows
C:> cd qtbase
C:> configure -prefix C:stall -xplatform blackberry-armle-v7-qcc -opengl es2 -nomake examples
-nomake tests -opensource -confirm-license -release
For the PlayBook:
C:> cd qtbase
C:> configure -prefix C:stall -device blackberry-playbook-armle-v7 -opengl es2 -nomake examples
-nomake tests -opensource -confirm-license -release -no-c+''11 -no-pps
And afterwards we simply build it by calling mingw32-make and mingw32-make install.
mingw32-make -j
mingw32-make install
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 -no-c11 option when compiling on Mac OSX, since the current version of the toolchain does not support c11.
$ 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
The actual "build" step
After above steps have been completed you should have QtBase installed in the prefix directory (i.e. in $HOME/development/qnx/qt5 or in C:stall, depending on your operating system).
In order to complete build, we go through all modules and build them as "regular" Qt projects, but use use the qmake from our new Qt5 installation (i.e. from the prefix directory). A few modules have dependencies to each other. Make sure you build modules in the order as listed above.
Extend the path
On Linux or OS X
export PATH=$HOME/development/qnx/qt5/bin:$PATH
On Windows>
C:> set PATH=C:stall\bin;PATH
Build and install additional git submodules
On Linux or OS X:
cd <sub_module_name>
qmake
make -j<N>
make install
On Windows:
C:> cd <sub_module_name>
C:> qmake
C:> mingw32-make -j
C:> mingw32-make -j install
How to use this build
You next reading should be Using custom Qt builds on BlackBerry 10 devices . It will explain how configure Qt Creator with the new build and how to use it in application development.