KOS Development with QT

Purpose

This document describes how to compile and run QT applications using KOS.

  • How to enable QT
  • How to configure QT for compilation on your target using KOS
  • How to run/debug a QT application using the QT Creator development environment with a KOS device.

Enabling QT

KOS makes it easy to enable QT in your image. Simply select the KOS release and add the QT6 option to your build. You should NOT select Chromium if you select QT. You must have graphics enabled.

For performing development with QT, you should also select the Developer Tools option and select the QT Developer Tools (if this option is visible).

Select and configure KOS Release in Image Configuration

QT Creator Development Configuration

This section describes how a developer would use KOS to develop their QT application. You will need a node running KOS in this section. It may be either a physical node or a simulator node. You will also need to have QT Creator installed on your development computer.

We recommend using a physical node for this process. If the node is a simulator, you will need to be aware of the network ports in use, mapping them in KOS Studio such that they are exposed to your development system. This is less complicated with a non-simulator node.

The steps to follow for QT Development are:

  • Enable QT per the above instructions.
  • Install QT Creator on your development machine.
  • Use the instructions from QT available at Build applications on remote Linux devices | Qt Creator Documentation as a guide, but we will clarify a few items:
    • You should establish connectivity using the dev user with ssh
    • When setting up CMake, it should point to /usr/bin/cmake
    • When configuring the QT Version, point to qmake at /usr/bin/qmake
    • When configuring the compiler, point to gcc at /usr/bin/gcc
    • When configuring the KIT, Scroll to the bottom and select CHANGE on CMake Configuration. The following keys should be set
      -DQT_HOST_PATH:FILEPATH=/usr/libexec
      -DQT_HOST_PATH_CMAKE_DIR:FILEPATH=/usr/lib/cmake

  • When configuring the KIT, for Run Environment, set the following value:
    DISPLAY=:0
  • Verify Network Settings – by including the QT6-developer option, TCP ports 10000-10100 are opened. If the configuration for your KOS device uses ports other than this, then you may have issues with debugging your application. The firewall may be turned off with the command, nft flush ruleset. See KOS documentation for opening ports on your KOS device.

QT Application Development Walkthrough

Once you have configured QT Creator, you can perform application development on your KOS target. This section walks through the process for developing an application using QT Creator and KOS.

First, with QT Creator in Preferences->Devices, make sure your remote KOS Device is set up and connected. If it isn’t, then make sure your KOS device is up and then select Test.

Now, let’s create a simple Hello World application.

  • Go to Create Project->Application(Qt)
  • Select QT Quick Application
  • For Project Location, you must select the remote device. Under Create In, you will see an option for Remote. Select the KOS Device in the left pane, and then store your application under the /home/dev home directory. This directory is retained across reboots.

  • Select the Kit you created on the remote KOS device in the previous section.

You now should be able to build and debug your application from QT Creator through the normal means. You can see a screenshot below: