Qt 6 in OpenEmbedded and Yocto

Embedded developers have been using the open source meta-qt5 layer for years with their OpenEmbedded and Yocto builds. We have also been using it extensively in our Qt for Device Creation product and have tried to do our part in keeping the latest Qt version available in the upstream layer. With Qt 6 on its way, there was a clear need for a new meta layer for providing continued support for building Qt for embedded devices. 

Work for the new layer was started quite early when the Qt 6 build system change to CMake was still being developed and, for obvious reason, the layer was named meta-qt6. The switch from qmake to CMake as the build system of choice has caused large changes in Qt code and the recipes in meta-qt6 are mostly written from scratch to account this change. The good news is that thanks to use of CMake, most of the recipes are now much simpler than they were with qmake. 

Building Qt with meta-qt6 

Switching from meta-qt5 to meta-qt6 for building Qt or your own application should be quite straightforward, as long as your application code is still compatible with Qt 6 after the API changes. The Qt module recipes are still there as before, qtbase is still qtbase, although not all Qt modules from meta-qt5 are initially available in the Qt 6.0 release. Some of them are planned to be released in later Qt releases, some have been or will later be merged with other parts of Qt and some of them have been dropped completely.

In order to build a CMake project with meta-qt6, you now need to inherit qt6-cmake class in your recipe. Similarly, if your project is using qmake, you now need to inherit qt6-qmake. Even though Qt 6 is now using CMake for building itself, qmake remains supported for application development, so you can still use qmake for your application builds.

For configuring the qtbase module, the most important PACKAGECONFIG options are still the same, but otherwise changes have been made. If you need to change the qtbase configuration, see details in the qtbase recipe and make sure that you are using the correct PACKAGECONFGs or using the CMake style configure options.

Toolchains

The example SDK recipe is now meta-toolchain-qt6 which contains all the available Qt 6 modules and tools needed for building Qt applications. For easier Qt Creator integration, we have included additional CMake toolchain file (Qt6Toolchain.cmake) that can be used without sourcing the usual environment-setup script from the toolchain. Using qmake from the toolchain this way continues to be supported as it already is with meta-qt5.

Additionally, we have integrated meta-mingw support, which allows you to build toolchains that can be run natively on a Windows hosts. The Windows toolchain still has some limitations compared to native Linux development environment as not all the development tools can be currently built for MinGW.

Contributions

The meta-qt6 layer is available with MIT license via Qt Gerrit with a git mirror available in code.qt.io. Contributions are welcome using the Qt Code Review in similar fashion as contributions to the Qt code. Qt Gerrit works nicely for code reviews and it also lets us utilize the Qt CI system for build verification before commits are merged. Bugs and other issues can be reported and discussed in Qt Bug Tracker using component Yocto: meta-qt6 layer.


Blog Topics:

Comments