Environment variables

In the app descriptor file, you can define environment variables that your app can access from its sandbox environment. In our sample Qt apps, these variable settings define the logging level or the app's physical display area, but you can set any variable you want.

Environment variables are set using <env> tags, where the var attribute lists the variable's name and the value attribute lists its value:

<env var="QQNX_PHYSICAL_SCREEN_SIZE" value="150,90"/>

Physical display area

The QQNX_PHYSICAL_SCREEN_SIZE variable defines the height and width of the app's display area on the screen. The width is listed first, followed by a comma, followed by the height. Note that the dimensions are specified in millimeters, not pixels. This is because the QNX Apps and Media target requires a physical unit and not a virtual unit.

We strongly recommend setting this variable to better control how your app is shown in the target HMI. If you don't define this variable, the display size defaults to 150 mm by 90 mm, which may not be optimal for viewing your app. Also, you'll receive a stdout warning when starting your app, although it will still run.

Library paths

The LD_LIBRARY_PATH variable should not be used to define the path of dynamic libraries used by your app. When defined in your project, this variable setting overrides the system setting on the target. The target environment must be configured so all essential libraries, including Qt and other commonly used libraries, are visible to the dynamic linker. For instance, on the target, LD_LIBRARY_PATH may be set to:

lib:/usr/lib:/usr/qt5-5.3/lib

Suppose you override this variable in the project for a Qt app so that it can access certain libraries in its sandbox, as follows:

<env var="LD_LIBRARY_PATH" value="app/native/lib"/>

In this case, your app won't start on the target because the dynamic linker won't be able to find the Qt libraries or any shared libaries outside of the app/native/lib path needed by the app. While you could expand the project variable setting to include all the paths in the target's LD_LIBRARY_PATH value, this depends on you knowing the target's setup, which might not be the case if you're developing apps for a third party. Also, if the target setup changes, you would have to update your project settings.

We recommend that you instead define the RPATH link option in your project to give the app access to the libraries included in its sandbox environment.