Packaging Qt apps with the library

After the library has been added to the project of a Qt app, the packaging process for the app remains mostly the same, except for two extra steps.

To package QtApp so it can use QtLibrary, you must:
  1. Edit the project file ( to add this line:
    QMAKE_LFLAGS += "-Wl,-rpath,app/native/lib"

    This instruction embeds the path of the library file ( into the QtApp binary. When the launcher service runs QtApp in its sandbox environment, the service uses a root path of app/native. All files within the Blackberry ARchive (BAR) package are relative to this location. For instance, from the perspective of QtApp, its icon file is found at app/native/icon.png.

    To package into the lib subdirectory in the BAR file, we set rpath to the root path appended with this subdirectory (i.e., app/native/lib).

  2. Update the arguments for the packaging command as follows: %{sourceDir}\bar-descriptor.xml QtApp
     -C %{sourceDir} %{sourceDir}\icon.png
     -e ProjectBuildDir\ lib/

    The newly added –e option is followed by two paths. The first is the library file's build location on the host system (in this case, replace ProjectBuildDir with the path containing the output library file) and the second is the relative location of the library file within the BAR package. Note that the file is purposely renamed from to

    Note: The directory separators in this example are backslashes (\), which are used for Windows, but you must use the appropriate separator for your OS (i.e., "/" if you're running Linux). The exception is the second path for -e; this must use the Linux separator because it specifies a relative location on the QNX target, which follows the POSIX directory convention.

    If you're using Qt Creator to package the app, you must access the Build & Run tab and edit the build step for the packaging command to add these arguments, as explained in "Packaging the app into a BAR file from Qt Creator". In the above example, ProjectBuildDir is the build directory specified in the General section of the Build Settings page.

    You can also package the app from the command line, by passing these arguments to blackberry-nativepackager in a QNX Neutrino terminal, as described in "Packaging the BAR file from the command line".