Deploying Kanzi applications to QNX¶
Before you can build a Kanzi application for your target platforms, set up and configure the Kanzi build environment for your target platforms. The build environment includes tools that the Kanzi build system uses to build your application for your target platforms.
Requirements¶
To build and deploy Kanzi applications to QNX, you need:
QNX software development platform 7.1.
Library requirements from the QNX software development platform:
slog2
You can get the QNX development tools at https://blackberry.qnx.com.
For SCons-based platform package:
For SCons 3.0.0 to 4.2.0, Python 3.5 or newer.
For SCons 4.3.0 or newer, Python 3.6 or newer.
For Cmake-based platform package: CMake 3.21 and Ninja 1.10.x
Before deploying your Kanzi application to your QNX target device, make sure that device is running the QNX Screen service. See https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.screen/topic/manual/cscreen_about.html.
Supported build systems, STDLIB implementation, and library linking¶
Kanzi platform packages support these build systems:
SCons. Note that this platform package name does not contain
SConsin its name.When you extract this platform package, you can find it in the
Engine/configs/platforms/<QNX platform version>directory.The platform package contains the
SConstructandconfig.pyfiles.CMake. Note that this platform package contains
-cmakein its name.When you extract this platform package, you can find it in the
Engine/cmake/toolchains/<QNX platform version>.The platform package contains the
<QNX platform version>.cmakefile that lists the CMake options used to create it.
Kanzi offers QNX platform packages that are based on these STDLIB implementations:
LLVM. You can recognize this implementation by the
_cxxor-cxxin the name of the platform package archive.When you build applications with this package, use the:
SCons flag
--stdlib=qnxCMake define
-DKANZI_QNX_STDLIB=qnx
GNU. CMake-based platform packages explicitly mention
gppin the name of the platform package archive.When you build applications with this package, use the:
SCons flag
--stdlib=gnuCMake define
-DKANZI_QNX_STDLIB=gnu
Kanzi platform packages support these library linking options:
Static. There is no
sconsflag as it is the default option.To build an application with statically linked libraries, use the CMake define
-DKANZI_BUILD_SHARED_LIBS:BOOL=OFF.Dynamic.
To build an application with dynamically linked libraries, use the:
SCons flag
--dynamicCMake define
-DKANZI_BUILD_SHARED_LIBS:BOOL=ON
On QNX with the LLVM C++ library, when you use in your Kanzi application a kzb file with a plugin dependency, do not use the runtime linker. Link the plugin SO to the application when you build the application executable. See https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.sys_arch/topic/dll.html and https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.utilities/topic/q/qcc.html.
Building Kanzi applications for QNX¶
Building Kanzi applications using CMake¶
For example, to build the kzb_player application on Linux for QNX 7.1 using CMake:
With the LLVM STDLIB implementation, from a -cxx platform package, with the shared library linking:
cd Engine/applications/kzb_player mkdir build cd build cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/qnx710-aarch64.cmake -DPLATFORM_BACKEND=qnx_screen -DCMAKE_INSTALL_PREFIX=../bin -DKANZI_QNX_STDLIB=qnx -DKANZI_BUILD_SHARED_LIBS:BOOL=ON -DKanzi_DIR=../../lib/cmake/Kanzi -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON .. cmake --build . cmake --install .
With the GNU STDLIB implementation, from a Non-cxx platform package:
cd Engine/applications/kzb_player mkdir build cd build cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/qnx710-aarch64.cmake -DPLATFORM_BACKEND=qnx_screen -DCMAKE_INSTALL_PREFIX=../bin -DKANZI_QNX_STDLIB=gnu -DKanzi_DIR=../../lib/cmake/Kanzi -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON .. cmake --build . cmake --install .
Building Kanzi applications for QNX using SCons¶
SCons runs the SConstruct file in the configuration directory of the platform from which you run the scons command. SConstruct file is the entry point for building the application and contains the information about the Kanzi Engine location and runs these files:
<KanziWorkspace>/Engine/configs/platforms/common/config.pyincludes the Kanzi library definitions and common build flags used when building for all platforms.<KanziWorkspace>/Engine/configs/platforms/<PlatformName>/config.pyincludes the Kanzi platform-specific build flags and defines, and the toolchain. Edit this file when you want to customize the build configuration for your platform. For example, to match the locations of your platform SDK and board support package.<ProjectName>/Application/configs/platforms/common/config.pyincludes the optional, project-specific common configuration parameters.<ProjectName>/Application/configs/platforms/<PlatformName>/config.pyincludes the optional, project-specific platform configuration parameters.
To build Kanzi applications for QNX using Scons:
In Kanzi Studio select File > Open Kanzi Command Prompt and in the Kanzi Command Prompt in the configuration directory of the platform for which you want to build the Kanzi application (
<ProjectName>/Application/configs/platforms/<PlatformName>).For example, to build your Kanzi application for Linux, open the Kanzi Command Prompt in the
<ProjectName>/Application/configs/platforms/linux_x11_glx_cpp98directory.Run the
sconscommand with the build parameters for your Kanzi application.Syntax
scons <library> <type> <name>Parameters
library(Optional) the graphics library:
ES2builds the application with OpenGL ES 2.0ES3builds the application with OpenGL ES 3.0
type(Optional) the build type:
Releasebuilds the application with compiler optimizations enabled. The release option builds smaller files than the debug option. Use this option for production purposes. Default value.Debugbuilds the application with disabled compiler optimizations and contains full debug information you can use with a debugger. The debug option builds larger files and debug applications run slower. Use this option for development purposes.Profilingbuilds the application with compiler optimizations enabled and links the application against the Profiling build. Use this option when you want to measure the performance of different parts of Kanzi Engine. For example, when you want to find out how much time Kanzi uses on different tasks during application startup, or which parts of the application take a lot of time to run. See Measuring application performance.
name(Optional) the name of the project
Examples
// Builds the application with the default settings as specified // in config.py and SConstruct configuration files. scons
// Builds the debug version of the application. scons debug
// Builds the debug version of the application with the // OpenGL ES 3.0 graphics library from the |ks| // project named MyProject. scons ES3 debug MyProject
Scons builds the Kanzi application source code and binary files in the <ProjectName>/Application/output directory.
Deploying Kanzi applications to a QNX device¶
To deploy Kanzi applications to QNX:
Build your Kanzi application for QNX. See Building Kanzi applications for QNX.
Connect your QNX device to your computer.
From the
<ProjectName>/Application/outputdirectory copy to your QNX target device:Kanzi application exe file
kzb files that your Kanzi application uses
application.cfgfile which contains a list of all the kzb files your Kanzi application uses
On your QNX target device open the command line and add execution rights for your Kanzi application on that device:
// Adds execution rights on the QNX target device // for the Kanzi application called MyApplication. chmod 755 MyApplication
On the command line start the application on your QNX target device:
// Starts the Kanzi application called MyApplication. ./MyApplication
Printing Screen display information¶
You can list QNX Screen display information for your Kanzi application.
To print Screen display information:
Deploy your Kanzi application to QNX. See Deploying Kanzi applications to a QNX device.
Run the application with the
-enum-qnx-displayscommand-line argument:./MyApplication -enum-qnx-displays
The application prints for each display this information and exits:
Display ID
Whether the display is attached
Whether the display is detachable
Whether the display is focused
Current resolution of the display
(Optional) If you run the application as root:
All available video modes
Current video mode
Setting QNX Screen usage flags¶
You can programmatically set the usage flags for the QNX Screen property. Screen usage flags are properties that you can use to constrain the allocated QNX window buffers. See QnxUsageFlags.
Known issues on QNX¶
When you run multiple Kanzi applications and receive an error like this
error:generic:/home/admin/ws/0/ui/Engine/source/core.ui/platform/windowing/qnx_screen/kzs_window_native.cpp:179> Unable to retrieve window size Process 1482838 (ClusterApp) terminated SIGSEGV code=1 fltno=11 ip=000000121378c348(/var/data/j01/bin/kanzi/./ClusterApp@_ZNSt7__cxx1115basic_stringbufIcSt11char_traitsIcESaIcEED0Ev+0x0000000000007d78) mapaddr=00000000004d4348. ref=0000000000000010
In each Kanzi application, you must set the
NativeWindowProperties::groupNameto a unique name. See GroupName.QNX deprecated the use of QCC as CXX compiler. The compilation of a QNX application fails with the error
QCC is not a full path and was not found in the PATH.
When you compile a QNX application for Kanzi versions before 3.9.4, in build configuration files replace the deprecated QCC compiler command with the q++ command.
For CMake, edit
Engine/cmake/toolchains/qnx7*.cmaketo replaceset(CMAKE_CXX_COMPILER QCC)
with
set(CMAKE_CXX_COMPILER q++)
For SCons, edit:
Engine/configs/platforms/qnx/config.pyto replacedefault.env["CC"] = os.path.join(toolchain_bin, "QCC") default.env["CXX"] = os.path.join(toolchain_bin, "QCC")
with
default.env["CC"] = os.path.join(toolchain_bin, "q++") default.env["CXX"] = os.path.join(toolchain_bin, "q++")
Engine/scripts/build.pyto replacere.compile(r'^([^/]*/)*QCC$'),
with
re.compile(r'^([^/]*/)*q\+\+$'),