Qt for QNX Runtime Target Requirements
QNX Software Systems delivers software solutions for making embedded devices. This includes creation of QNX Neutrino RTOS boot images in a very flexible way. Even though QNX provides several reference scripts for the OS image creation, sooner or later you will need to make changes or you might decide to create an OS image from scratch. Qt relies on the existence of several third-party components and selected OS services. Due to this, QNX Neutrino RTOS boot images for a target device running Qt must meet the requirements listed in the following sections to ensure that Qt works as expected.
QNX Screen Graphics Subsystem
Before any Qt application can be started, the QNX Screen Graphics Subsystem (also called just "Screen") must be running. Screen
consists of a driver and several utilities and services which are used by Qt. This includes processing of mouse and keyboard events as well. You can ensure that Screen
is configured and running correctly by verifying that a graphics application, like gles2-gears
, can be started and runs without problems.
Most of the recent sample OS build scripts in the SDP include sections with all components and start commands for the Screen. You can use them as a reference.
IPv6 support
Qt's networking stack requires IPv6 support to be enabled, independent of whether the actual networking uses IPv4 or IPv6.
Warning: io-pkt-v6-hc
must be running, not io-pkt-v4
.
Random device /dev/random
Qt requires /dev/random
to be present and functional. Start it before starting any Qt application or during the system startup:
random -p waitfor /dev/random
System Logger
QNX provides the slog2 logging framework tailored to specifics of embedded systems. The major advantage of it is a much better performance than a text output to files. Qt uses this framework by default for any logging output going through QDebug on QNX Neutrino RTOS. The slog2
service should be started during the system startup. The slog2
also relies on the existence of the /tmp
folder which has to be configured as well, for example:
[type=link] /tmp=/dev/shmem display_msg "Starting slogger2..." slogger2 -U1001:1000 & waitfor /dev/slog2
Environment Variables
There is a set of environment variables you should set when starting a Qt application. Most of them are actually not specific to QNX Neutrino RTOS. They are still mentioned here, since knowing them just saves a lot of time in case of problems.
Note: setconf
and getconf
are required to access POSIX environment variables, especially for the host name and time and date.
Qt runtime location
If you did not build Qt with the RPATH environment variable set, you can place the Qt runtime components in any folder in the file system. The following environment variables should point to valid locations assuming that the Qt installation is located in <Qt-install-path>
:
LD_LIBRARY_PATH
should contain the path to the Qt libraries in<Qt-install-path>/lib
.QT_PLUGIN_PATH
defines where the Qt plug-ins are located. It should be set to<Qt-install-path>/plugins
.QML2_IMPORT_PATH
defines where the Qt Quick plug-ins are located. It should be set to<Qt-install-path>/qml
.- If Qt does not use fontconfig, you must either provide the path to the fonts with
QT_QPA_FONTDIR
, or place the fonts under<Qt-install-path>/lib/fonts
which is the default font location. - Check
QT_QPA_QNX_DISPLAY_CONFIG
for the number and order of available screens/displays.
Physical screen size
Qt needs information about the physical dimensions of the attached display to determine DPI values and thus set correct font sizes. Usually, this information is provided by the Screen. In some cases you may see an invalid screen size such as 0mmx0mm. In such a case Qt requires an environment variable QQNX_PHYSICAL_SCREEN_SIZE
set to according values to get the required information. If Qt applications exit with an error message saying that the physical screen size couldn't be determined, set the variable like this before starting the Qt application:
export QQNX_PHYSICAL_SCREEN_SIZE=150,100
to inform Qt that the screen has a width of 150mm and a height of 100mm in this particular case. The physical screen size is measured in millimeters (mm) and should correspond to the actual physical size of the display in the final configuration.
Troubleshooting the First Start of a Qt Application
The only drawback of the flexibility provided by QNX Neutrino RTOS is a risk that the run environment is slightly different on your target than what is expected by Qt. This is a common reason why a Qt application on a new target fails to start. A few generic environment variables can help locate the root cause for problems:
- Setting
QT_DEBUG_PLUGINS
to1
helps to see why the QPA plugin cannot load. - Setting
LD_DEBUG
to1
helps to see where and how shared libraries are loaded. This can be used in combination withQT_DEBUG_PLUGINS
when a plugin failed to load because it could not load other shared libraries. - Setting
QT_LOGGING_TO_CONSOLE
will force sending all logging messages tostderr
instead ofslog2
. This is useful for analyzing application startup problems, as you do not need to use another tool to see the messages.
© 2024 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.