Qt Framework
Install Qt Creator
Qt Creator provides a complete Integrated Development Environment for application developers to create applications for multiple targets such as embedded systems, mobile devices, desktops. To install Qt Creator from its installer, download it according to the chosen license. Make sure that you always have the latest release installed.
Run the installer:
$ ./qt-unified-linux-x64-<version>-online.run
It might be necessary to change the installer file mode to executable.
The commercial license enables Qt For Device Creation which provides a set of ready-to-use tools for developing in Qt Creator IDE for embedded systems such as Yocto based Boot to Qt pre-built images and cross-compilation toolchains for a series of target devices (iMX8 and iMX6, iMX6 and iMX7). These components may be installed during Qt Creator installation.
Visit the Qt Creator Manual for further information about the IDE and its features according to the given license.
Once Qt Creator is installed in the host machine, it is necessary to have a Qt-enabled target device image as well as a built Software Development Kit (SDK). At last, this SDK must be configured in Qt Creator in order to build and deploy applications in your target module.
Configure Qt Creator
Before starting Qt Creator, we have to export some build environment variables. Qt uses special configuration files to describe the built environment called mkspecs (they specify which compiler, linker, or other tools to use). However, this configuration files still need to know where the compiler (or cross-compiler in our case) is located. The SDK created a script that does all the hard work.
Using the SDK built with OpenEmbedded layers, source the script as follows:
$ . /opt/clea-os-embedded-wayland/4.0.5/environment-setup-armv8a-poky-linux
It is required to source the script to export the environment variables every time in the same terminal session you run Qt Creator
The environment variable OE_QMAKE_CXX
should then show something along
this line:
$ echo $OE_QMAKE_CXX
aarch64-poky-linux-g++ -march=armv8-a+crc -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/clea-os-embedded-wayland/4.0.5/sysroots/armv8a-poky-linux
Now, start Qt Creator in the shell where you sourced the script.
$ qtcreator
Add the Target Device
Go to Tools → Options. In the left panel, click on Devices and add a new device representing the target device:
- Press Add and choose Generic Linux Device
- Specifiy a name (e.g. Remote Linux Device)
- Fill in the device's IP address
- Authentication on our modules by default: Username
root
- Deploy the public key with the button Deploy Public Key...
- Make a Test to validate the configuration
Add Kit
Select the version of the Qt Kit you want to add from the tabs below.
- Qt 5
- Qt 6
In the left panel, click on Build & Run and configure in the following tabs:
- Qt Versions:
- Press Add
- Choose
/opt/clea-os-embedded-wayland/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/qmake
- Fill in a name
- Compilers (C):
- Press Add -> Gcc
- Name: GCC C Embedded
- Compiler path:
/opt/clea-os-embedded-wayland/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
- ABI (should be detected automatically): arm-linux-generic-elf-64bit
- Compilers (C++)
- Press Add -> Gcc
- Name: GCC C++ Embedded
- Compiler path:
/opt/clea-os-embedded-wayland/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++
- ABI (should be detected automatically): arm-linux-generic-elf-64bit
- Debuggers:
- Press Add
- Name: Embedded
- Path:
/opt/clea-os-embedded-wayland/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gdb
- Kit
- Press Add
- Name: 5.15.3 Embedded
- Run Device Type: Remote Linux Device
- Run Device: Remote Linux Device
- Compiler C: GCC C Embedded
- Compiler C++: GCC C++ Embedded
- Debugger: Embedded
- Qt version: Qt 5.15.3 (Embedded)
Now one can create a new project using the new Kit. Qt Creator automatically configures build configurations for the cross-compiling Kit.
To make sure that the binaries get deployed to the root home folder, add
the following to your .pro
file:
target.path = /home/root
INSTALLS += target
If you have an existing project, you can configure Build & Run Configurations under the Project tab on the left side. Go to Add Kit, we can now use the newly created Kit 5.15.3 Embedded.
When using Qt Embedded, you may want to switch to the Run
configuration and add the argument -qws
to the binary as standalone
(instead of using the Qt for Embedded Linux server).
In the left panel, click on Build & Run and configure in the following tabs:
- Qt Versions:
- Press Add
- Choose
/opt/clea-os-embedded-wayland/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/qmake
- Fill in a name
- Compilers (C):
- Press Add -> Gcc
- Name: GCC C Embedded
- Compiler path:
/opt/clea-os-embedded-wayland/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
- ABI (should be detected automatically): arm-linux-generic-elf-64bit
- Compilers (C++)
- Press Add -> Gcc
- Name: GCC C++ Embedded
- Compiler path:
/opt/clea-os-embedded-wayland/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++
- ABI (should be detected automatically): arm-linux-generic-elf-64bit
- Debuggers:
- Press Add
- Name: Embedded
- Path:
/opt/clea-os-embedded-wayland/4.0.5/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gdb
- Kit
- Press Add
- Name: 6.5.2 Embedded
- Run Device Type: Remote Linux Device
- Run Device: Remote Linux Device
- Compiler C: GCC C Embedded
- Compiler C++: GCC C++ Embedded
- Debugger: Embedded
- Qt version: Qt 6.5.2 (Embedded)
Now one can create a new project using the new Kit. Qt Creator automatically configures build configurations for the cross-compiling Kit.
To make sure that the binaries get deployed to the root home folder, add
the following to your .pro
file:
target.path = /home/root
INSTALLS += target
If you have an existing project, you can configure Build & Run Configurations under the Project tab on the left side. Go to Add Kit, we can now use the newly created Kit 6.5.2 Embedded.
When using Qt Embedded, you may want to switch to the Run
configuration and add the argument -qws
to the binary as standalone
(instead of using the Qt for Embedded Linux server).