Building for QNX

To use Qt Safe Renderer and its examples on QNX target devices, you need to build the following projects:

ProjectDescription.pro file name.pro file pathBuild with Qt version
Qt Safe Layout ToolQt Safe Layout Tool generates safe layout data for Qt Safe Renderer.qtsafelayouttool.pro<Qt installation directory>/Src/QtSafeRenderer-<version>/tools/qtsafelayouttoolQt that is compiled for your host platform.
Qt Safe RendererWhen you build Qt Safe Renderer, the Qt Safe Renderer plugins are built and installed under the current kit in Qt Creator (that is, the Qt version that you use for building the projects).qtsaferenderer.pro<Qt installation directory>/Src/QtSafeRenderer-<version>Qt compiled for QNX.

For QNX, Qt Safe Renderer provides the following examples:

ProjectDescription.pro file name.pro file pathBuild with Qt version
The Qt Cluster exampleQt Cluster demonstrates rendering on QNX and recovery from the main UI failure.qtcluster.pro<Qt installation directory>/Examples/QtSafeRenderer-<version>/qtclusterQt compiled for QNX
The Telltales exampleWhen you build Telltales, you must use the Qt compiled for QNX. Then the QNX specific part of the project is built. The Process Watcher project is built together with the QNX specific Telltales.examples.pro<Qt installation directory>/Examples/QtSafeRenderer-<version>/Qt compiled for QNX

Building Qt Safe Layout Tool

To build Qt Safe Layout Tool in Qt Creator, execute the steps listed in the following topics for qtsaferenderer.pro. Build the project with a Qt version that is compiled for your host platform. After a successful build, qtsafelayouttool is generated under <Qt installation directory>/<Qt version>/<compiler>/bin.

Opening Project to Edit Mode

Open the project to Qt Creator's Edit mode:

  • Start Qt Creator.
  • Select File > Open File or Project and browse to a .pro file.
  • Select Open.
  • In the Configure Project page, choose a kit for building the project and select Configure Project. The project is now open in Qt Creator's Edit mode.

Adding a Custom Build Step <make install>

Note: If you are building some of the examples in Qt Safe Renderer, you can skip this step.

Before building Qt Safe Renderer, add a custom build step that installs the binary file under <Qt installation directory>/<Qt version/<compiler>/bin in the Qt version that is used for building the project:

  • Select a Projects mode.
  • In the kit, select Build.
  • Select Build Settings > Build Steps > Add Build Step > Make.
  • In Make arguments, add install.
  • Select the Edit mode. Your custom build step is automatically saved.

Building the Project

Build the project in the Edit mode by selecting Build > Build Project "<project name>".

Setting Up Cross Compiling Environment

After you have built Qt Safe Layout Tool, you must copy the generated Qt Safe Layout Tool binary file (qtsafelayouttool) to your cross compiling environment. The Qt Safe Layout Tool binary must be in a same directory where you have the qmake tool.

You find the generated qtsafelayouttool under <Qt installation directory>/<Qt version>/<compiler>/bin.

For example, copy the Qt Safe Layout Tool binary file under /opt/qt5.9.2/install/qnx7-armle-v7/bin/.

Building Qt Safe Renderer and Examples

To build Qt Safe Renderer and its examples for QNX, you must first configure and build Qt from sources. You must also add some modifications to the Qt Base source code so that it supports Qt Safe Renderer for QNX. The following topics describe how you get Qt sources, how you should modify them, and how you build Qt from sources:

Getting Qt Sources

You can download the Qt source code via your Qt Account.

You can also get the Qt sources via the Git version control system. Qt Wiki has instructions for getting Qt sources via Git, see https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_source_code.

Modifying Qt Base for Qt Safe Renderer

To add Qt Safe Renderer support in the qtbase repository, you need to modify the QNX platform plugin code file qqnxwindow.cpp under the path qtbase/src/plugins/platforms/qnx/. Add an include of QDebug as follows:

  1. #include <QtCore/QDebug>
  2. #include <QDebug> // add this line to qqnxwindow.cpp
  3. #include <errno.h>

Update QQnxWindow::setBufferSize(const QSize &size) as follows:

  1. if (nonEmptySize == m_bufferSize || format == -1)
  2. return;
  3. int pipeline = 1; // add this line
  4. screen_set_window_property_iv(m_window, SCREEN_PROPERTY_PIPELINE, &pipeline); // add this line
  5. Q_SCREEN_CRITICALERROR(
  6. screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, &format),
  7. "Failed to set window format");

The following code provides all the required updates in a .patch file format:

  1. src/plugins/platforms/qnx/qqnxwindow.cpp | 5 ++++-
  2. 1 file changed, 4 insertions(+), 1 deletion(-)
  3. diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
  4. index 30288cc..c2702b1 100644
  5. --- a/src/plugins/platforms/qnx/qqnxwindow.cpp
  6. +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
  7. @@ -52,7 +52,7 @@
  8. #include "private/qguiapplication_p.h"
  9. #include <QtCore/QDebug>
  10. -
  11. +#include <QDebug>
  12. #include <errno.h>
  13. #if defined(QQNXWINDOW_DEBUG)
  14. @@ -355,6 +355,9 @@ void QQnxWindow::setBufferSize(const QSize &size)
  15. if (nonEmptySize == m_bufferSize || format == -1)
  16. return;
  17. + int pipeline = 1;
  18. + screen_set_window_property_iv(m_window, SCREEN_PROPERTY_PIPELINE, &pipeline);
  19. +
  20. Q_SCREEN_CRITICALERROR(
  21. screen_set_window_property_iv(m_window, SCREEN_PROPERTY_FORMAT, &format),
  22. "Failed to set window format");

Configuring and Building Qt for QNX

Configure Qt for QNX by running the following command in a terminal (note that the following example configures Qt 5.9.3)):

  1. ./configure -confirm-license -commercial -release -xplatform \
  2. qnx-armle-v7-qcc -opengl es2 -nomake tools -skip qtactiveqt \
  3. -skip qtandroidextras -skip qtconnectivity -skip qtdoc -skip qtenginio \
  4. -skip qtlocation -skip qtmacextras -skip qtsensors -skip qtserialport \
  5. -skip qtwinextras -skip qtx11extras -openssl -nomake examples -nomake tests \
  6. -force-debug-info -separate-debug-info -skip qtwebengine -no-fontconfig \
  7. -prefix /opt/qt5.9.3/install/qnx7-armle-v7

Build Qt with the make command in the terminal. You can run make with as many cores on your host machine as you desire. In our example we use six cores:

  1. make -j6

Building Qt Safe Renderer and Examples

After you have built Qt, you can start Qt Creator and build the Qt Safe Renderer and its QNX specific examples, Telltales and Qt Cluster.

In Qt Creator, you must set the path to the QNX environment script as follows:

  • Select Tools > Options > Devices > QNX.
  • Select Add.
  • Enter the path for the file qnxsdp-env.sh that is included in QNX Software Development Platform (SDP). By default, the path is /opt/qnx700 in Linux and C:\qnx700 in Windows.
  • Select Open.
  • Select Generate kits. After you have set the path, it appears to Host and Target fields under Configuration information.

To enable a QNX build in Qt Creator, you must set the Qt version with Qt Safe Renderer related QNX modifications to your kit. See Adding Kits.

You can build Qt Safe Renderer, Telltales, and Qt Cluster for QNX with the same steps that are described in Building Qt Safe Layout Tool. Just remember that in Opening Project to Edit Mode, you must select the kit that contains the Qt Safe Renderer changes for QNX. The kit is selected from the Configure Project page.

When you build the Telltales example, also a Process Watcher project is built.

Deploying to Target Device

You need to deploy Qt Cluster and Telltales to your QNX target device. When you deploy Telltales, also Process Watcher is deployed. You can deploy the projects in Qt Creator with the following steps:

  • Connect your target device to Qt Creator.
  • In Qt Creator, select Tools > Options > Devices > Devices.
  • Under Device, select your QNX device.
  • Select Deploy Qt libraries. After you have deployed the Qt libraries to your QNX device, also all Qt Safe Renderer libraries are copied to the device.

Building for Host PlatformBuilding for INTEGRITY

Available under certain Qt licenses.Find out more.