Setting up Qt Creator for QNX Neutrino OS: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=Setting up Qt Creator for <span class="caps">QNX</span> Neutrino OS=
[[Category:QNX]]<br />[[Category:HowTo]]


==Overview==
[toc align_right=&quot;yes&amp;quot; depth=&quot;2&amp;quot;]


The <span class="caps">QNX</span> plugin is available in Qt Creator since the version 2.6. It provides support for application development for BlackBerry 10 smartphones as well as for <span class="caps">QNX</span> Neutrino OS on embedded devices.
= Setting up Qt Creator for QNX Neutrino OS =


You can download a recent Qt Creator release version via this [http://download.qt.io/development_releases/qtcreator/ link] ''[download.qt.io]''.
== Overview ==


The <span class="caps">QNX</span> plugin is under constant development. Many improvements and bug fixes did not make into the recently released 3.1 version. If you want to try a cutting-edge Qt Creator build that contains latest features and bug fixes in the <span class="caps">QNX</span> plugin, you can consider downloading a snapshot build via this [https://download.qt.io/snapshots/qtcreator/master/ link] ''[download.qt.io]''.
The QNX plugin is available in Qt Creator since the version 2.6. It provides support for application development for BlackBerry 10 smartphones as well as for QNX Neutrino OS on embedded devices.


A few generic topics on this page overlap with the [[QNX-App-development-and-deployment|Qt application development and deployment on <span class="caps">QNX</span>]] page which focuses on the command line use case.
You can download a recent Qt Creator release version via this &quot;link&amp;quot;:http://download.qt.io/development_releases/qtcreator/.
 
The QNX plugin is under constant development. Many improvements and bug fixes did not make into the recently released 3.1 version. If you want to try a cutting-edge Qt Creator build that contains latest features and bug fixes in the QNX plugin, you can consider downloading a snapshot build via this &quot;link&amp;quot;:https://download.qt.io/snapshots/qtcreator/master/.
 
A few generic topics on this page overlap with the [[QNX-App-development-and-deployment | Qt application development and deployment on QNX]] page which focuses on the command line use case.


'''''Note:''''' The steps described in this page cover Qt Creator 3.1 feature level. If you are using a previous version, some steps might need to be done slightly different.
'''''Note:''''' The steps described in this page cover Qt Creator 3.1 feature level. If you are using a previous version, some steps might need to be done slightly different.


==Getting Started==
== Getting Started ==


The following tools are required for development for the <span class="caps">QNX</span> platform using Qt Creator:
The following tools are required for development for the QNX platform using Qt Creator:


* Qt build for <span class="caps">QNX</span> installed on your target and on your development machine
* Qt build for QNX installed on your target and on your development machine
* Qt Creator 3.1 (most steps should be valid for the version 2.6 and later as well)
* Qt Creator 3.1 (most steps should be valid for the version 2.6 and later as well)  
* <span class="caps">QNX</span> Software Development Platform (<span class="caps">SDP</span>) 6.6 (most steps should be valid for <span class="caps">SDP</span> 6.5 FP1 as well)
* QNX Software Development Platform (SDP) 6.6 (most steps should be valid for SDP 6.5 FP1 as well)
* <span class="caps">QNX</span> <span class="caps">SDK</span> for Apps and Media 1.0 if you use <span class="caps">SDP</span> 6.6. This is an optional package providing additional BlackBerry tools for easy deployment and installation of applications on a target.
* QNX SDK for Apps and Media 1.0 if you use SDP 6.6. This is an optional package providing additional BlackBerry tools for easy deployment and installation of applications on a target.


==Setup your Qt Creator environment==
== Setup your Qt Creator environment ==


You first have to manually add your Qt for <span class="caps">QNX</span> as a new Qt version, configure the compiler, the debugger and create the kit. In the future Qt Creator releases, <span class="caps">QNX</span> plugin should be able to automatically setup all these tools by just selecting the path to the installed <span class="caps">QNX</span> <span class="caps">SDP</span>.
You first have to manually add your Qt for QNX as a new Qt version, configure the compiler, the debugger and create the kit. In the future Qt Creator releases, QNX plugin should be able to automatically setup all these tools by just selecting the path to the installed QNX SDP.


===Add the Qt version===
=== Add the Qt version ===


You add the Qt version by selecting '''Tools -&gt; Options -&gt; Build &amp; Run &gt; Qt Versions -&gt; Add''' and set the path to “qmake” in your Qt for <span class="caps">QNX</span> build. You also need to specify a path to the <span class="caps">QNX</span> <span class="caps">SDP</span> installation to let Qt Creator to validate the newly added Qt version:
You add the Qt version by selecting '''Tools <s>&gt; Options</s>&gt; Build &amp; Run &gt; Qt Versions -&gt; Add''' and set the path to &quot;qmake&amp;quot; in your Qt for QNX build. You also need to specify a path to the QNX SDP installation to let Qt Creator to validate the newly added Qt version:


[[Image:qtcreator-qnx-qt.png]]
[[Image:https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-qt.png|https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-qt.png]]


This won’t be required in the future releases of Qt Creator. If you are using a Qt for <span class="caps">QNX</span> installer with integrated Qt Creator build, the new Qt version for <span class="caps">QNX</span> will be detected automatically and added to this Qt Creator installation.
This won't be required in the future releases of Qt Creator. If you are using a Qt for QNX installer with integrated Qt Creator build, the new Qt version for QNX will be detected automatically and added to this Qt Creator installation.


===Add the <span class="caps">QCC</span> compiler===
=== Add the QCC compiler ===


Select '''Tools -&gt; Options -&gt; Build &amp; Run -&gt; Compiler -&gt; Add -&gt; <span class="caps">QCC</span>''' and set the path to the qcc compiler ('''&lt;qnx660_path&gt;/host/&lt;OS&gt;/x86/usr/bin/qcc'''). Since qcc depends on some <span class="caps">QNX</span> specific environment variables, you need to specify the path to the <span class="caps">QNX</span> <span class="caps">SDP</span> installation as well:
Select '''Tools <s>&gt; Options</s>&gt; Build &amp; Run <s>&gt; Compiler</s>&gt; Add -&gt; QCC''' and set the path to the qcc compiler ('''&lt;qnx660_path&amp;gt;/host/&amp;lt;OS&amp;gt;/x86/usr/bin/qcc'''). Since qcc depends on some QNX specific environment variables, you need to specify the path to the QNX SDP installation as well:


[[Image:qtcreator-qnx-compiler.png]]
[[Image:https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-compiler.png|https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-compiler.png]]


===Add a debugger===
=== Add a debugger ===


Select '''Tools -&gt; Options -&gt; Run &amp; Build -&gt; Debugger''' and set the path to the '''ntoarmv7-gdb''' debugger ('''&lt;qnx660_path&gt;/host/&lt;OS&gt;/x86/usr/bin/ntoarmv7-gdb''') or '''ntox86-gdb''' if you’re targeting x86:
Select '''Tools <s>&gt; Options</s>&gt; Run &amp; Build -&gt; Debugger''' and set the path to the '''ntoarmv7-gdb''' debugger ('''&lt;qnx660_path&amp;gt;/host/&amp;lt;OS&amp;gt;/x86/usr/bin/ntoarmv7-gdb''') or '''ntox86-gdb''' if you're targeting x86:


[[Image:qtcreator-qnx-debugger.png]]
[[Image:https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-debugger.png|https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-debugger.png]]


===Add <span class="caps">QNX</span> Device===
=== Add QNX Device ===


Select '''Tools -&gt; Options -&gt; Devices -&gt; Add -&gt; <span class="caps">QNX</span> Device''' to register your <span class="caps">QNX</span> device in Qt Creator.
Select '''Tools <s>&gt; Options</s>&gt; Devices <s>&gt; Add</s>&gt; QNX Device''' to register your QNX device in Qt Creator.


[[Image:qtcreator-qnx-device.png]]
[[Image:https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-device.png|https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-device.png]]


===Add a kit===
=== Add a kit ===


Select '''Tools -&gt; Options -&gt; Build &amp; Run -&gt; Kits -&gt; Add''' to add a new kit that uses the <span class="caps">QNX</span> device, the Qt version , the compiler and the debugger your setup during the steps above:
Select '''Tools <s>&gt; Options</s>&gt; Build &amp; Run <s>&gt; Kits</s>&gt; Add''' to add a new kit that uses the QNX device, the Qt version , the compiler and the debugger your setup during the steps above:


[[Image:qtcreator-qnx-kit.png]]
[[Image:https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-kit.png|https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-kit.png]]


==Compile and Deploy==
== Compile and Deploy ==


Compiling and deploying applications for <span class="caps">QNX</span> is very similar to how it is done for “Remote Linux” devices, see the Qt Creator manual for more information via this [http://doc-snapshot.qt.io/qtcreator-3.1/creator-deployment-qnx.html link] ''[doc-snapshot.qt.io]''.
Compiling and deploying applications for QNX is very similar to how it is done for &quot;Remote Linux&amp;quot; devices, see the Qt Creator manual for more information via this &quot;link&amp;quot;:http://doc-snapshot.qt.io/qtcreator-3.1/creator-deployment-qnx.html.


===Pointing to the Qt runtime on the target===
=== Pointing to the Qt runtime on the target ===


When running the application on the <span class="caps">QNX</span> device, you might need to specify the path to where the Qt runtime is installed on the device. This is done in the “Run Settings” of your project in Qt Creator. The application will not start if this is not done, check the logs to find out if this is the case.
When running the application on the QNX device, you might need to specify the path to where the Qt runtime is installed on the device. This is done in the &quot;Run Settings&amp;quot; of your project in Qt Creator. The application will not start if this is not done, check the logs to find out if this is the case.


A Qt application can be pointed to the location of the Qt runtime by a few environment variables. Set the following environment variables:
A Qt application can be pointed to the location of the Qt runtime by a few environment variables. Set the following environment variables:
<code><br />LD_LIBRARY_PATH=/&amp;lt;qt_installation_path&amp;gt;/lib<br />QML_IMPORT_PATH= /&amp;lt;qt_installation_path&amp;gt;/imports<br />QML2_IMPORT_PATH= /&amp;lt;qt_installation_path&amp;gt;/qml<br />QT_PLUGIN_PATH=/&amp;lt;qt_installation_path&amp;gt;/plugins<br />QQNX_PHYSICAL_SCREEN_SIZE=&quot;150,90&amp;quot;<br /></code>


'''''Note:''''' If your target already uses some of those variables system-wide, make sure if append or prepend the new values
'''''Note:''''' If your target already uses some of those variables system-wide, make sure if append or prepend the new values


The '''<span class="caps">QQNX</span>_PHYSICAL_SCREEN_SIZE''' environment variable is <span class="caps">QNX</span> specific and defines the height and width of the app’s display area on the screen in millimeters:
The '''QQNX_PHYSICAL_SCREEN_SIZE''' environment variable is QNX specific and defines the height and width of the app's display area on the screen in millimeters:


[[Image:qtcreator-qnx-environment.png]]
[[Image:https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-environment.png|https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-environment.png]]


If your build does not use fontconfig you also need to point where to find the Qt fonts:<br />
If your build does not use fontconfig you also need to point where to find the Qt fonts:<br /><code><br />export QT_QPA_FONTDIR=/&amp;lt;qt_installation_path&amp;gt;/lib/fonts<br /></code>


===The destination folders for application deployment===
=== The destination folders for application deployment ===


The simplest way to deploy an app on a target is to copy its binaries into a remote folder. Qt Creator does all this for your. You just need to make sure that the destination folder is correct and is writable.
The simplest way to deploy an app on a target is to copy its binaries into a remote folder. Qt Creator does all this for your. You just need to make sure that the destination folder is correct and is writable.


If your .pro file does not already contain specific deployment instructions for the <span class="caps">QNX</span> platform or contains instructions specific for another platform, make sure a valid target path is set as following:
If your .pro file does not already contain specific deployment instructions for the QNX platform or contains instructions specific for another platform, make sure a valid target path is set as following:
 
<code><br />#<br /># /tmp is mapped to a RAM drive on many devices. This means your app will be deleted after the next reboot.<br />#<br />qnx {<br /> target.path = /tmp/$${TARGET}/bin<br /> INSTALLS += target<br />}<br /></code>


'''''Note:''''' Most Qt examples already contain deployment instructions in their .pro files, e.g.:
'''''Note:''''' Most Qt examples already contain deployment instructions in their .pro files, e.g.:


Put the above “qnx” instructions below such a line.
<code><br />target.path = $$[QT_INSTALL_EXAMPLES]/quick/example_xyz<br /></code>


===Using tools for application deployment provided in the <span class="caps">QNX</span> <span class="caps">SDK</span> for Apps &amp; Media===
Put the above &quot;qnx&amp;quot; instructions below such a line.


If you use '''<span class="caps">QNX</span> <span class="caps">SDK</span> for Apps and Media''', you can use the additional BlackBerry tools to package your application as a <span class="caps">BAR</span> file. This is pretty similar to the packaging of BlackBerry 10 applications. See [http://www.qnx.com/developers/docs/660/topic/com.qnx.doc.qnxcar2.qt.guide/topic/packaging.html?cp=1_5_3_2 this article] ''[qnx.com]'' in the <span class="caps">QNX</span> developer documentation for more details.
=== Using tools for application deployment provided in the QNX SDK for Apps &amp; Media ===


The installation of the application packaged in a <span class="caps">BAR</span> file on the target is explained in [http://www.qnx.com/developers/docs/660/topic/com.qnx.doc.appsandmedia.lifecycle/topic/install_task.html this] ''[qnx.com]'' article.
If you use '''QNX SDK for Apps and Media''', you can use the additional BlackBerry tools to package your application as a BAR file. This is pretty similar to the packaging of BlackBerry 10 applications. See &quot;this article&amp;quot;:http://www.qnx.com/developers/docs/660/topic/com.qnx.doc.qnxcar2.qt.guide/topic/packaging.html?cp=1_5_3_2 in the QNX developer documentation for more details.


==Using CMake build system==
The installation of the application packaged in a BAR file on the target is explained in &quot;this&amp;quot;:http://www.qnx.com/developers/docs/660/topic/com.qnx.doc.appsandmedia.lifecycle/topic/install_task.html article.


Qt Creator provides a CMake plugin to manage CMake based projects. The plugin is currently not fully functional when you want to deploy and run your application on remote targets in general by default. If you develop for <span class="caps">QNX</span> using CMake and Qt Creator please follow the below instructions to fix this.
== Using CMake build system ==


* When you create a new CMake project using the Qt Creator, the CMake wizard won’t provide any CMake generator for <span class="caps">QNX</span> kits. This is a known issue in QtCreator 3.1 that should be fixed in the 3.1.1 patch release. Please download a recent 3.1.1 snapshot build [https://download.qt.io/snapshots/qtcreator/3.1.1/ here] ''[download.qt.io]'' to skip this issue.
Qt Creator provides a CMake plugin to manage CMake based projects. The plugin is currently not fully functional when you want to deploy and run your application on remote targets in general by default. If you develop for QNX using CMake and Qt Creator please follow the below instructions to fix this.


* The default CMakeList.txt file generated by Qt Creator in the root folder of your CMake project doesn’t cover the <span class="caps">QNX</span> platform. You either have to use an appropriate cmake toolchain file for <span class="caps">QNX</span> or add the following configuration lines in CMakeList.txt specifying <span class="caps">QNX</span> <span class="caps">SDP</span> 6.6 toolchain:
* When you create a new CMake project using the Qt Creator, the CMake wizard won't provide any CMake generator for QNX kits. This is a known issue in QtCreator 3.1 that should be fixed in the 3.1.1 patch release. Please download a recent 3.1.1 snapshot build &quot;here&amp;quot;:https://download.qt.io/snapshots/qtcreator/3.1.1/ to skip this issue.


* In order to deploy the application binary into your <span class="caps">QNX</span> target with QtCreator, you should add a QtCreatorDeployment.txt file in the root directory of your CMake project and specify the location where your binary should de deployed, e.g.:
* The default CMakeList.txt file generated by Qt Creator in the root folder of your CMake project doesn't cover the QNX platform. You either have to use an appropriate cmake toolchain file for QNX or add the following configuration lines in CMakeList.txt specifying QNX SDP 6.6 toolchain:


or another writable folder on your target.
<code><br />SET (CMAKE_SYSTEM_NAME QNX)<br />SET (CMAKE_SYSTEM_VERSION 6.6.0)<br />SET (CMAKE_SYSTEM_PROCESSOR armv7) # or SET (CMAKE_SYSTEM_PROCESSOR x86)<br />SET (TOOLCHAIN QNX)
 
IF (CMAKE_HOST_WIN32)<br /> SET (HOST_EXECUTABLE_SUFFIX &amp;quot;.exe&amp;quot;)<br />ENDIF (CMAKE_HOST_WIN32)
 
FIND_PATH(QNX_HOST<br /> NAME usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}<br /> PATHS $ENV{QNX_HOST} &lt;path_to_your_qnx_host&amp;gt;<br /> NO_CMAKE_PATH<br /> NO_CMAKE_ENVIRONMENT_PATH<br />)
 
FIND_PATH(QNX_TARGET<br /> NAME usr/include/qnx_errno.h<br /> PATHS $ENV{QNX_TARGET} &lt;path_to_your_qnx_target&amp;gt;<br /> NO_CMAKE_PATH<br /> NO_CMAKE_ENVIRONMENT_PATH<br />)
 
SET (CMAKE_C_COMPILER $&amp;#123;QNX_HOST&amp;#125;/usr/bin/nto$&amp;#123;CMAKE_SYSTEM_PROCESSOR&amp;#125;-gcc$&amp;#123;HOST_EXECUTABLE_SUFFIX&amp;#125;)<br />SET (CMAKE_CXX_COMPILER $&amp;#123;QNX_HOST&amp;#125;/usr/bin/nto$&amp;#123;CMAKE_SYSTEM_PROCESSOR&amp;#125;-c++$&amp;#123;HOST_EXECUTABLE_SUFFIX&amp;#125;)<br /></code>
 
* In order to deploy the application binary into your QNX target with QtCreator, you should add a QtCreatorDeployment.txt file in the root directory of your CMake project and specify the location where your binary should de deployed, e.g.:


'''''Note:''''' If your need to deploy additional files, your should specify them as well in the QtCreatorDeployment.txt as explained in the [http://doc.qt.io/qtcreator-3.0/creator-project-cmake.html documentation] ''[qt.io]''.
<code><br />/account/devuser/me/myApp<br /></code>


* The CMake plugin in Qt Creator does not support running remote executables yet, and the run configuration provides only the option to run a local executable. Thus, you need to manually add the necessary steps to run a custom executable on the target via ssh. For a <span class="caps">QNX</span> project, you can simply add a new '''Run custom remote command''' deploy step and specify the path to your executable in the target machine to run it during the deployment step.
or another writable folder on your target.


===Categories:===
'''''Note:''''' If your need to deploy additional files, your should specify them as well in the QtCreatorDeployment.txt as explained in the &quot;documentation&amp;quot;:http://doc.qt.io/qtcreator-3.0/creator-project-cmake.html.


* [[:Category:HowTo|HowTo]]
* The CMake plugin in Qt Creator does not support running remote executables yet, and the run configuration provides only the option to run a local executable. Thus, you need to manually add the necessary steps to run a custom executable on the target via ssh. For a QNX project, you can simply add a new '''Run custom remote command''' deploy step and specify the path to your executable in the target machine to run it during the deployment step.
* [[:Category:QNX|QNX]]

Revision as of 14:34, 23 February 2015


[toc align_right="yes&quot; depth="2&quot;]

Setting up Qt Creator for QNX Neutrino OS

Overview

The QNX plugin is available in Qt Creator since the version 2.6. It provides support for application development for BlackBerry 10 smartphones as well as for QNX Neutrino OS on embedded devices.

You can download a recent Qt Creator release version via this "link&quot;:http://download.qt.io/development_releases/qtcreator/.

The QNX plugin is under constant development. Many improvements and bug fixes did not make into the recently released 3.1 version. If you want to try a cutting-edge Qt Creator build that contains latest features and bug fixes in the QNX plugin, you can consider downloading a snapshot build via this "link&quot;:https://download.qt.io/snapshots/qtcreator/master/.

A few generic topics on this page overlap with the Qt application development and deployment on QNX page which focuses on the command line use case.

Note: The steps described in this page cover Qt Creator 3.1 feature level. If you are using a previous version, some steps might need to be done slightly different.

Getting Started

The following tools are required for development for the QNX platform using Qt Creator:

  • Qt build for QNX installed on your target and on your development machine
  • Qt Creator 3.1 (most steps should be valid for the version 2.6 and later as well)
  • QNX Software Development Platform (SDP) 6.6 (most steps should be valid for SDP 6.5 FP1 as well)
  • QNX SDK for Apps and Media 1.0 if you use SDP 6.6. This is an optional package providing additional BlackBerry tools for easy deployment and installation of applications on a target.

Setup your Qt Creator environment

You first have to manually add your Qt for QNX as a new Qt version, configure the compiler, the debugger and create the kit. In the future Qt Creator releases, QNX plugin should be able to automatically setup all these tools by just selecting the path to the installed QNX SDP.

Add the Qt version

You add the Qt version by selecting Tools > Options> Build & Run > Qt Versions -> Add and set the path to "qmake&quot; in your Qt for QNX build. You also need to specify a path to the QNX SDP installation to let Qt Creator to validate the newly added Qt version:

https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-qt.png

This won't be required in the future releases of Qt Creator. If you are using a Qt for QNX installer with integrated Qt Creator build, the new Qt version for QNX will be detected automatically and added to this Qt Creator installation.

Add the QCC compiler

Select Tools > Options> Build & Run > Compiler> Add -> QCC and set the path to the qcc compiler (<qnx660_path&gt;/host/&lt;OS&gt;/x86/usr/bin/qcc). Since qcc depends on some QNX specific environment variables, you need to specify the path to the QNX SDP installation as well:

https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-compiler.png

Add a debugger

Select Tools > Options> Run & Build -> Debugger and set the path to the ntoarmv7-gdb debugger (<qnx660_path&gt;/host/&lt;OS&gt;/x86/usr/bin/ntoarmv7-gdb) or ntox86-gdb if you're targeting x86:

https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-debugger.png

Add QNX Device

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

https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-device.png

Add a kit

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

https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-kit.png

Compile and Deploy

Compiling and deploying applications for QNX is very similar to how it is done for "Remote Linux&quot; devices, see the Qt Creator manual for more information via this "link&quot;:http://doc-snapshot.qt.io/qtcreator-3.1/creator-deployment-qnx.html.

Pointing to the Qt runtime on the target

When running the application on the QNX device, you might need to specify the path to where the Qt runtime is installed on the device. This is done in the "Run Settings&quot; of your project in Qt Creator. The application will not start if this is not done, check the logs to find out if this is the case.

A Qt application can be pointed to the location of the Qt runtime by a few environment variables. Set the following environment variables:

<br />LD_LIBRARY_PATH=/&amp;lt;qt_installation_path&amp;gt;/lib<br />QML_IMPORT_PATH= /&amp;lt;qt_installation_path&amp;gt;/imports<br />QML2_IMPORT_PATH= /&amp;lt;qt_installation_path&amp;gt;/qml<br />QT_PLUGIN_PATH=/&amp;lt;qt_installation_path&amp;gt;/plugins<br />QQNX_PHYSICAL_SCREEN_SIZE=&quot;150,90&amp;quot;<br />

Note: If your target already uses some of those variables system-wide, make sure if append or prepend the new values

The QQNX_PHYSICAL_SCREEN_SIZE environment variable is QNX specific and defines the height and width of the app's display area on the screen in millimeters:

https://raw.githubusercontent.com/blackberry/Qt/master/screenshots/qnx/qtcreator-qnx-environment.png

If your build does not use fontconfig you also need to point where to find the Qt fonts:

<br />export QT_QPA_FONTDIR=/&amp;lt;qt_installation_path&amp;gt;/lib/fonts<br />

The destination folders for application deployment

The simplest way to deploy an app on a target is to copy its binaries into a remote folder. Qt Creator does all this for your. You just need to make sure that the destination folder is correct and is writable.

If your .pro file does not already contain specific deployment instructions for the QNX platform or contains instructions specific for another platform, make sure a valid target path is set as following:

<br />#<br /># /tmp is mapped to a RAM drive on many devices. This means your app will be deleted after the next reboot.<br />#<br />qnx {<br /> target.path = /tmp/$${TARGET}/bin<br /> INSTALLS += target<br />}<br />

Note: Most Qt examples already contain deployment instructions in their .pro files, e.g.:

<br />target.path = $$[QT_INSTALL_EXAMPLES]/quick/example_xyz<br />

Put the above "qnx&quot; instructions below such a line.

Using tools for application deployment provided in the QNX SDK for Apps & Media

If you use QNX SDK for Apps and Media, you can use the additional BlackBerry tools to package your application as a BAR file. This is pretty similar to the packaging of BlackBerry 10 applications. See "this article&quot;:http://www.qnx.com/developers/docs/660/topic/com.qnx.doc.qnxcar2.qt.guide/topic/packaging.html?cp=1_5_3_2 in the QNX developer documentation for more details.

The installation of the application packaged in a BAR file on the target is explained in "this&quot;:http://www.qnx.com/developers/docs/660/topic/com.qnx.doc.appsandmedia.lifecycle/topic/install_task.html article.

Using CMake build system

Qt Creator provides a CMake plugin to manage CMake based projects. The plugin is currently not fully functional when you want to deploy and run your application on remote targets in general by default. If you develop for QNX using CMake and Qt Creator please follow the below instructions to fix this.

  • When you create a new CMake project using the Qt Creator, the CMake wizard won't provide any CMake generator for QNX kits. This is a known issue in QtCreator 3.1 that should be fixed in the 3.1.1 patch release. Please download a recent 3.1.1 snapshot build "here&quot;:https://download.qt.io/snapshots/qtcreator/3.1.1/ to skip this issue.
  • The default CMakeList.txt file generated by Qt Creator in the root folder of your CMake project doesn't cover the QNX platform. You either have to use an appropriate cmake toolchain file for QNX or add the following configuration lines in CMakeList.txt specifying QNX SDP 6.6 toolchain:
<br />SET (CMAKE_SYSTEM_NAME QNX)<br />SET (CMAKE_SYSTEM_VERSION 6.6.0)<br />SET (CMAKE_SYSTEM_PROCESSOR armv7) # or SET (CMAKE_SYSTEM_PROCESSOR x86)<br />SET (TOOLCHAIN QNX)

IF (CMAKE_HOST_WIN32)<br /> SET (HOST_EXECUTABLE_SUFFIX &amp;quot;.exe&amp;quot;)<br />ENDIF (CMAKE_HOST_WIN32)

FIND_PATH(QNX_HOST<br /> NAME usr/bin/qcc${HOST_EXECUTABLE_SUFFIX}<br /> PATHS $ENV{QNX_HOST} &lt;path_to_your_qnx_host&amp;gt;<br /> NO_CMAKE_PATH<br /> NO_CMAKE_ENVIRONMENT_PATH<br />)

FIND_PATH(QNX_TARGET<br /> NAME usr/include/qnx_errno.h<br /> PATHS $ENV{QNX_TARGET} &lt;path_to_your_qnx_target&amp;gt;<br /> NO_CMAKE_PATH<br /> NO_CMAKE_ENVIRONMENT_PATH<br />)

SET (CMAKE_C_COMPILER $&amp;#123;QNX_HOST&amp;#125;/usr/bin/nto$&amp;#123;CMAKE_SYSTEM_PROCESSOR&amp;#125;-gcc$&amp;#123;HOST_EXECUTABLE_SUFFIX&amp;#125;)<br />SET (CMAKE_CXX_COMPILER $&amp;#123;QNX_HOST&amp;#125;/usr/bin/nto$&amp;#123;CMAKE_SYSTEM_PROCESSOR&amp;#125;-c++$&amp;#123;HOST_EXECUTABLE_SUFFIX&amp;#125;)<br />
  • In order to deploy the application binary into your QNX target with QtCreator, you should add a QtCreatorDeployment.txt file in the root directory of your CMake project and specify the location where your binary should de deployed, e.g.:
<br />/account/devuser/me/myApp<br />

or another writable folder on your target.

Note: If your need to deploy additional files, your should specify them as well in the QtCreatorDeployment.txt as explained in the "documentation&quot;:http://doc.qt.io/qtcreator-3.0/creator-project-cmake.html.

  • The CMake plugin in Qt Creator does not support running remote executables yet, and the run configuration provides only the option to run a local executable. Thus, you need to manually add the necessary steps to run a custom executable on the target via ssh. For a QNX project, you can simply add a new Run custom remote command deploy step and specify the path to your executable in the target machine to run it during the deployment step.