Set Up QT Dev Environment for QNX 7.0 – Expert Guide

1. Introduction to QNX qt development tools and QNX supports qt modules:

Qt is a highly recommended UI and application development platform for embedded devices powered by the QNX Neutrino Operating System. This system is not a pre-packaged software, but rather a solution for embedded development, and Qt is an integral part of this solution. Qt has been successfully ported to QNX for a long time and there is a dedicated Qt community within the QNX community to ensure seamless communication between QNX-Qt users.

In terms of support for QNX, the QNX Neutrino Real-Time Operating System provides support for almost all of the essential modules of Qt, as well as some additional components. The following modules can be utilized on the QNX Neutrino OS platform for regular builds and unit testing:

Qt 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.

To utilize Qt on QNX, you must first acquire the software. There are two options for obtaining Qt:

  • Download a pre-built custom version from either the QNX vendor or Qt company.
  • Clone the Qt git source library and build the necessary submodules one by one using the main repository. The process is described in detail on the website:

Alternatively, you can compile the source code yourself. For further instructions, please refer to a related blog.

To cross-compile Qt for QNX, follow the steps outlined in the related resources.

The use of Qt can be divided into two types:

Configuring Qt development tools with the IDE Momentics provided by QNX SDP 7.0 involves the following steps:

  • Obtain the Qt license key from the QNX official website.
  • Download the Qt Runtime package from the QNX Software Center. This package, based on Qt 5.6.2, includes the Qt Quick Controls module, the necessary compilation tools (such as qmake, qcc, etc.) to generate executable files, and library files supporting the QNX Neutrino RTOS.
  • After downloading, add the export path to your system environment variables:
  • C:\Users\system_name\qnx700\qt\Qt5.6.2\win64\x86_64\target\x86_64\bin;C:\Users\system_name\qnx700\qt\Qt5.6.2\win64\x86_64\target\x86_64
  • Restart your system and open the command line. Type in “qmake –query” and you should see the results displayed.

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

Once your new project is complete, use the previously configured tools to compile it. If successful, you can then deploy the Qt5 Runtime to the target machine. In order for the application to run, the lib, plugins, and qml import files of Qt5 must be accessible from the application’s location. There are two options for achieving this:

  1. Copy the Qt Runtime to the corresponding location on the target system.
  2. Mount the folder containing the Qt Runtime and binaries to the board using NFS. This method is convenient during development as the files remain on the host PC and can be easily modified, leading to a shorter development and testing cycle.

4. Deploy Qt Runtime
To set up the Qt5 environment on a QNX board, follow these steps:

  1. Copy the “lib”, “plugins”, and “qml” folders from the Qt installation to a target folder on the QNX file system, such as a new “qt5” folder in the “/usr” directory. Only the necessary files should be copied for simplification purposes.
  2. Deploy the compiled application to the QNX system and execute it from a remote shell on the target machine. The following prerequisites must be met:
    • i. The QNX target is running the “Screen Graphics Subsystem”.
    • ii. The Qt Runtime environment variables are set as described in the next section.
  3. Set the following environment variables on the QNX board:
    • i. LD_LIBRARY_PATH is set to the path of the Qt library, “/lib”.
    • ii. QT_PLUGIN_PATH defines the location of the Qt plugin and should be set to “/plugins”.
    • iii. QML2_IMPORT_PATH defines the location of Qt Quick2 and should be set to “/qml”.
    • iv. QT_QPA_FONTDIR, if Qt does not use fontconfig, must define the path of the font used by Qt, which can be set to “/lib/fonts”.
    • v. QQNX_PHYSUCAL_SCREEN_SIZE defines the height and width of the application display area on the screen in millimeters, which may be set by some boot images during global booting. This variable determines the final size displayed on the screen and can be set to “150, 90” (adjust as needed according to the specific situation).

5. Platform and Compiler Instructions

To deploy a Qt program on QNX Neutrino RTOS, the following requirements must be met:

  • QNX Screen Graphics Subsystem must be running.
  • IPv6 support must be enabled.
  • The /dev/random device must exist and be functional.
  • The system logger, slog2, must be started during system startup.
  • A set of environment variables must be set.
  • The physical screen size must be provided to Qt if it is invalid.
  • Third-party libraries such as libfontconfig, libfreetype, libiconv, libicui18n, libicudata, libicuuc, libpng16, libxml14, libsqlite3, libssl, and libcrypto must be included in the system image.
  • Troubleshooting can be done by setting environment variables such as QT_DEBUG_PLUGINS, LD_DEBUG, and QT_LOGGING_TO_CONSOLE.
  • A Chinese-supported library, such as NotoSans, must be downloaded if the program requires a Chinese display.
<?xml version="1.0" encoding="UTF-8"?>
<!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

To resolve the issue of the failing load config file, you can either add the environment variable “export FONTCONFIG_FILE=/qt5/lib/fontconfig/local.conf” or create a new local.conf as described above and set the environment variable “export FONTCONFIG_PATH=/qt5/lib/fontconfig/”. The difference between these two options is whether you are specifying the location of 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:

To set up the Qt environment on your target machine, follow these steps:

  1. Create a new “qt5” folder under “usr” and copy the “qml”, “lib”, and “plugins” folders from the cross-compilation chain to this new folder.
  2. Add the following environment variables in the “.profile” file under “etc”:
    • 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 QQNX_PHYSICAL_SCREEN_SIZE=150,90
    • export QT_DEBUG_PLUGINS=1
    • export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/qt5/plugins/ platforms
    • export QT_QPA_FONTDIR=/usr/qt5/lib/fonts
  3. Restart the system.
  4. Start the screen.
  5. To debug any missing libraries, run the following command:
    • export LD_DEBUG=libs openglwindow
  6. Finally, execute the openglwindow program by running the command “$./openglwindow”.

Leave a Reply