QT ​​development environment configuration for the QNX 7.0 platform

1. Introduction to QNX qt development tools and QNX supports qt modules:-
Qt is one of the recommended UI and application development platforms for embedded devices based on QNX Neutrino OS. QNX Neutrino OS is not a ready-made software package, but an embedded solution development and Qt is also part of this solution. Qt has been ported to QNX a long time ago, and there is a Qt column in the QNX community to ensure the communication of QNX-qt users

What is Qt’s support for QNX? QNX Neutrino RTOS supports almost all Qt Essential modules and some additional components. The following lists modules that can currently run on the QNX Neutrino OS platform and can be used for regular builds and unit tests:

stateQt essential modulesstatenotes
Qt Coresupported
Qt Declarativenot supported
Qt GUIsupported
Qt Multimediasupportednot supported on x86, a few known issues
Qt Multimedia Widgetssupportednot supported on x86, a few known issues; no platform-style
Qt Networksupported
Qt QMLsupported
Qt Quicksupported
Qt Quick ControlssupportedNo platform style
Qt Quick DialogssupportedSome native styles only
Qt Quick Layoutssupported
Qt SQLsupported
Qt Testsupported
Qt WebKit QMLnot supportedDepends on Qt’s Declarative
Qt WebKit Widgetsnot supported Compiles and runs, but is not officially supported in 5.4
Qt WidgetssupportedNo platform style

Qt add onstatenotes
Active Qtnot applicable
Enginionot supported
Qt Android Extrasnot applicable
Qt Bluetoothnot supportedno OS backed defined yet
Qt Concurrentsupported
Qt D-Busnot applicable
Qt Graphical Effectssupported
Qt Image Formatssupported
Qt Mac Extrasnot applicable
Qt NFCnot supportedno OS backed defined yet
Qt OpenGLOnly OpenGL ES 2
Qt Positioningnot supportedno OS backed defined yet
Qt Print Supportsupportedonly printing to pdf
Qt Quick1not supported (might work)
Qt Scriptsupported
Qt Toolssupported
Qt Sensorsnot supportedno OS backed defined yet
Qt Serial Portnot supporteda backend is available; a candidate for a future release
Qt SVGsupported
Qt WebSocketsnot supported
Qt Windows Extrasnot applicable
Qt X11 Extrasnot applicable
Qt XMLsupported
Qt XML Patternspartly supportedXPath functionality is supported, but XML schema validation is not supported

“Supported” modules are provided in the binary Qt installers for QNX.

2 . Build Qt for QNX
To use Qt in QNX, you must first obtain Qt. There are two ways to obtain it:

i. Download the released custom version, available from the QNX vendor, or qt company.

ii. Clone the Qt git source library, use the main repository to build the necessary submodules at a time, build and install QtBase, and then build the submodules one by one as a separate project. Visible in detail


You can also compile it yourself with source code. For details, please refer to my other blog.

Cross-compile QT for QNX

The use of Qt can be divided into two types:

The first is to configure Qt development tools with IDE Momentics provided by QNX SDP 7.0,

i. This method needs to first obtain the Qt use license key on the QNX official website. Then download Qt Runtime from the QNX Software Center. The so-called Qt Runtime is a QNX runtime package based on Qt 5.6.2 that includes the Qt Quick Controls module. This package includes the necessary compilation tools (such as qmake, qcc, etc.) to generate executable files, and also includes library files that support QNX Neutrino RTOS. After the download is complete, add the export path.


ii. Shut down and restart, open the command line and enter qmake –query: the result is as follows:

The above screenshot shows that the qt configuration under QNX is correct, then open the Momentics IDE to configure the Qt path, open windows—>Qt—>Qt installs, and add the QMake path, as shown below

Then you can develop a Qt application program under IDE.

The second method, for some development pc without QNX, how to use the above version of Qt Runtime Tools with a qt license. High, as for why 4.3.1 is provided in the QNX documentation, this article has not been verified, and the higher version 4.5.1 has been tested, and there is no problem

3. Qt application development and deployment
Setting up the Qt Creator environment
First, you must manually add Qt for QNX as a new Qt version, configure the compiler, and debugger and create the toolkit.

Add Qt version

This can be done by selecting Tools->Options->Build & Run>Qt Versions->Add and setting the path to “qmake” in the Qt for QNX build. You also need to specify the path to the QNX SDP installation to let Qt Creator verify the newly added Qt version:

Add QCC compiler

Select Tools->Options->Build & Run->Compiler-> Add->QCC and set the path of qcc compiler (/host/x86_64/usr/bin/qcc). Since qcc relies on some QNX-specific environment variables, it is also necessary to specify the path to the QNX SDP installation:

add debugger

Select Tools->Options->Build & Run->Debuggers and set it to the ntoarmv7-GDB debugger (/host/x86/usr/bin/ntoarmv7-gdb). If the target machine is x86, select ntox86-gdb:

Add QNX device

Select Tools->Options->Devices->Add->QNX Device to register the QNX device in Qt Creator.

Execute the test. If any bin file is missing, you can find it on the development machine and copy it to the corresponding location on the target machine.

It should be noted that the addition of a QNX device requires a hardware device with qnx system installed or a QNX system installed in VMware. Otherwise, the QNX device cannot be added correctly, and if it cannot be added, the following development kit cannot be added and compilation cannot be performed.

add kit

Select Tools->Options->Build & Run->Kits->Add to add a new kit that uses the QNX device, Qt version, compiler, and debugger set up in the above steps:

4. Compile and deploy

After the new project is completed, apply the toolkit set up just now to compile. If the compilation is successful, the next step is to deploy the Qt5 Runtime to the target machine. In order for the application to be executable, the lib, plugins, and qml import files of Qt5 must be accessed from the location where the application is to be run, there are two options

i. Copy Qt Runtime to the corresponding location of the target version.

ii. The folder with the Qt Runtime and binaries can also be mounted from the board via NFS, this way is very useful during daily development as the files remain on the host PC and can be modified more easily, making the development test cycle very short.

4. Deploy Qt Runtime
Copy the three folders “lib”, “plugins”, and “qml” in the Qt installation to the QNX file system. The location of the target folder does not matter, as long as it can be accessed by the application and accurately added to the environment in the variable. For example, create a new qt5 folder in the /usr directory and copy the three folders copied earlier to it.

Small note: In order to simplify the system, it is not necessary to copy all the files, but to copy any files that are specifically needed.

Executing the Application
Once the application has been compiled, it must be deployed (ie copied) to the QNX system, and the application binary can then simply be executed from a remote shell on the target machine. But there are two prerequisites:

i. The QNX target already runs the “Screen Graphics Subsystem”

ii. The setting of Qt Runtime environment variables is described in the next section

Setting up the Qt5 environment on the target board
Qt5 applications need to be able to find the Qt Runtime (lib, plugins, qml import) at application startup. Therefore, the following environment variables must be set on the QNX board:

LD_LIBRARY_PATH is set to the Qt library path /lib;

QT_PLUGIN_PATH defines where the Qt plugin is located and should be set to /plugins;

QML2_IMPORT_PATH defines where Qt Quick2 is located and should be set to /qml;

QT_QPA_FONTDIR If Qt does not use fontconfig, you must also define the path of the font used by Qt, which can be set to /lib/fonts;

QQNX_PHYSUCAL_SCREEN_SIZE It defines the height and width of the application display area on the screen in millimeters, some boot images define this variable when global booting. That is to say, this variable determines the final size displayed on the screen, which can be set to “150, 90” (the specific setting needs to be adjusted according to the actual situation);

5. Platform and Compiler Instructions
Through the configuration of the above steps, you can now compile the program under qt creator and deploy the executable file to the target machine without any accidents, and then execute it. If it cannot be executed normally, please check the following operation requirements

The Qt runtime requirements

Qt relies on the presence of several third-party components and selected OS services. Therefore, a QNX Neutrino RTOS boot image for a target device running Qt must meet several requirements to ensure that Qt works as expected. The following sections list the key parts of Qt.

QNX Screen Graphics Subsystem
Before starting any Qt application, the QNX Screen Graphics Subsystem (also called “screen”) must be running. Screen not only contains drivers but also several utilities and other services used by Qt, including handling mouse and keyboard events. You can ensure that Screen is configured and running correctly by verifying that a graphics application such as gles2-gears can start and run without issue.

IPv6 support
Qt’s network stack needs to enable IPv6 support. Regardless of whether the actual network uses IPv4 or IPv6. This means, io-pkt-v6-hc must be running, not io-pkt-v4.

Random device /dev/random
Qt requires /dev/random to exist and be fully functional, start it before starting any Qt application or during system startup:

$ random -p

$ wait for /dev/random

System logger

QNX provides a slog2 logging framework tailored to the details of embedded systems. Its main advantage is better performance than file output. Qt uses this framework by default for any logging output via QDebug on QNX Neutrino RTOS. Slog2 should start the service during system startup. slog2 also depends on the existence of configured folders under /tmp. E.g:

[type=link] /tmp=/dev/shmem

display_msg “Starting slogger2…”

slogger2 -U1001:1000 &

waitfor /dev/slog2

Environment Variables
A set of environment variables should be set when starting a Qt application. Most of these are not actually specific to the QNX Neutrino RTOS. As mentioned above, here is just a complete introduction.

See above for the environment path of Qt Runtime. It should be noted that if Qt does not use fontconfig, you must specify the font path provided in Qt and set QT_QPA_FONTDIR=/usr/share/lib/fonts. Because Qt5 no longer provides qt fonts files, so this place is still using fontconfig.

Physical Screen Size

Qt needs information about the physical dimensions of the connected monitor to determine the DPI value and thus set the correct font size. Typically this information is provided by the screen, in some cases, invalid screen sizes may be seen. For example 0mm*0mm. In this case, Qt needs to set the environment variable QQNX_PHYSICAL_SCREEN_SIZE to the corresponding value to obtain the required information. If the Qt application exits with an error message that the physical screen size cannot be determined, set this variable before starting the Qt application.

Troubleshooting First Boot Tips for Qt Applications
The only downside to the great flexibility offered by the QNX Neutrino RTOS is that there is still the risk that the target will not be the same as Qt expected. This is a very common reason why the first Qt application fails to start on a new target. There are some general environment variables that can help to find the root cause of the problem:

i. Setting QT_DEBUG_PLUGINS=1 can help understand why the QPA plugin cannot be loaded;

ii. Set LD_DEBUG=1 to see where and how shared libraries are loaded. This variable can be used in conjunction with QT_DEBUG_PLUGINS when it cannot load a plugin because it cannot load some other shared library;

In addition, export LD_DEBUG=libs testapp can check what loading libraries are missing when the testapp is running;

iii. Setting QT_LOGGING_TO_CONSOLE will force all log messages to be sent to stderr instead of slog2. This is very handy for analyzing application startup issues since there are log messages that don’t need to use other tools to view the messages.

Third-Party Libraries
In order for Qt applications to function properly, it is necessary to ensure that the following additional third-party libraries are included in the system image, which is not always included in the minimal QNX Neutrino RTOS image:












Note: The above list is not a complete list of shared libraries used by Qt on QNX Neutrino OS. Quite a few shared libraries are already available in custom OS images. Or contained by other parts of the system. For example via Screen. In actual use, you can debug variables to see what libraries are missing and add what libraries.

Precautions and problem-solving
The problems encountered during the development process and the solutions are recorded here for reference

Chinese display
Download the Chinese-supported library. This article uses Google’s noto font, where NotoSansCJKsc-Medium.otf is the font style used, add it to the /usr/share/fonts folder, and set the environment variable at the same time:

export QT_QPA_FONTDIR=/usr/share/fonts

This solves the problem of displaying garbled characters in Chinese fonts.

The Fontconfig configuration file is loaded
and an error is reported during the running of the qt application:

Fontconfig error: Cannot load default config file


One method is to create a fontconfig folder under the qt runtime folder and create a new configuration file named local.conf. The content of the file is as follows: /usr/share/fonts fonts ~/.fonts

<?xml version="1.0"?>

<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<!-- /etc/fonts/fonts.conf file to configure system font access -->


<!-- Font directory list -->


<dir prefix="xdg">fonts</dir>

<!-- the following element will be removed in the future -->



Accept deprecated 'mono' alias, replacing it with 'monospace'


<match target="pattern">

<test qual="any" name="family">



<edit name="family" mode="assign" binding="same">




Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'


<match target="pattern">

<test qual="any" name="family">

<string>sans serif</string>


<edit name="family" mode="assign" binding="same">





Accept deprecated 'sans' alias, replacing it with 'sans-serif'


<match target="pattern">

<test qual="any" name="family">



<edit name="family" mode="assign" binding="same">





Load local system customization file


<include ignore_missing="yes">conf.d</include>

<!-- Font cache directory list -->


<cachedir prefix="xdg">fontconfig</cachedir>

<!-- the following element will be removed in the future -->




Rescan configuration every 30 seconds when FcFontSetList is called







So as to solve the problem of the load config file failing and then add the environment variable export FONTCONFIG_FILE=/qt5/lib/fontconfig/local.conf

i. Another method is to create a new local.conf as above, the difference is that instead of adding the FONTCONFIG_FILE environment variable, add:

export FONTCONFIG_PATH=/qt5/lib/fontconfig/

In fact, the difference lies in whether you are looking for a file or a folder.

QNX lib not found or load error solution

The error is as follows:

# ./test

This application failed to start because it could not find or load the Qt platform plugin "qnx"

in "/usr/qt5/plugins/platforms".

Available platform plugins are: minimal (from /usr/qt5/plugins/platforms), offscreen (from /usr/qt5/plugins/platforms), qnx (from /usr/qt5/plugins/platforms), minimal, offscreen, qnx.

Reinstalling the application may fix this problem.

Abort (core dumped)

The reason for not seeing the QNX library is to confirm whether the corresponding lib plugins qml environment variable is set, and at the same time confirm whether the screen is started normally. For other reasons, please refer to the requirements of the qt running configuration for the correct execution of the qt app.

Workaround for this error:

  1. First create a new qt5 folder under usr and copy the three folders qml, lib and plugins of qt in the cross-compilation chain to the newly created qt5 folder.
  2. Set environment variables Add qt environment variables in .profile under etc as follows

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/qt5/lib

export QT_PLUGIN_PATH=/usr/qt5/plugin

export QML2_IMPORT_PATH=/usr/qt5/qml



export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/qt5/plugins/ platforms

export QT_QPA_FONTDIR=/usr/qt5/lib/fonts

Note: /usr/qt5/ is the path where I store the qt5 library on the target machine, please change it to the actual storage path when setting.

  1. Restart the system
  2. Start the screen
  3. Add debugging instructions What library is missing and what library should be added export LD_DEBUG=libs openglwindow
  4. Execute $./openglwindow

Leave a Reply