Using meta-qt6 | Boot to Qt 6.7.2 (2024)

meta-qt6 is a meta layer for OpenEmbedded and Yocto that provides recipes for Qt modules and support for building your application using Qt. This topic provides common guidelines how you can use meta-qt6. For more detailed information about Yocto Project, see Yocto Project Documentation.

The meta-qt6 layer is available with MIT license and is under Qt Gerrit with 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 review 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

Using meta-qt6

Firstly, you need to include the meta-qt6 layer into your Yocto build environment. Typically, this means editing the conf/bblayers.conf file in order to include a path for meta-qt6. Then you can include any Qt module into your image or toolchain.

Configuring Qt modules

meta-qt6 provides recipes for each Qt module. Most recipes support PACKAGECONFIG options that you can use to modify features each Qt module is built with.

A reasonable default set of features is already enabled in meta-qt6 for each Qt module that has PACKAGECONFIG options, but depending on your feature needs, you can modify the configuration for each Qt module separately.

For example, if you want to enable all the examples in QtBase, you need to create a qtbase_git.bbappend file and add the PACKAGECONFIG option as follows:

PACKAGECONFIG += "examples"

Using Commercial Qt

By default, the meta-qt6 recipes configure Qt using Open Source licensing. Users with valid commercial license can change this, so that Qt is configured with commercial licensing enabled. This can be done with QT_EDITION variable in conf/local.conf or similar global configuration file:

Using Commercial Qt Add-ons

Some of the Qt add-on modules are commercial-only requiring a commercial license. These modules are not included in the default meta-toolchain-qt6 and packagegroup recipes unless variable QT_COMMERCIAL_MODULES=1 is set. QT_EDITION must also be set to commercial to enable the add-on modules.

To access the source code and build these add-ons, you must set up Qt Gerrit as per instructions at Setting up Gerrit.

Using Qt LTS Commercial Releases

Qt provides LTS (Long-term Support) releases with commercial license.

To build Qt LTS Commercial release in Yocto, the following steps need to be completed first:

  • Set up Qt Gerrit as per instructions at Setting up Gerrit.
  • Check out the correct LTS tag or branch on yocto/meta-qt6 git repository. The LTS releases are tagged as v6.x.y-lts.

Then, proceed to build Qt in Yocto as before.

Using https protocol for Qt code checkouts

By default, meta-qt6 uses ssh to fetch the Qt source code for LTS releases. If you're unable to use the ssh/git protocol, switch to use https by configuring it in your build environment:

QT_COMMERCIAL_GIT_PROTOCOL = "https"

Make sure that you have set up Gerrit and that your local build machine is set up for https access.

Building Static Version of Qt

By default, meta-qt6 builds Qt as a set of dynamic libraries. If needed, you can change the Qt configuration so that static libraries are produced instead. Your application is then linked against the static libraries and you can produce a single binary without additional dependencies to Qt libraries. You can enable a static Qt build by adding it into the qtbase's PACKAGECONFIG.

PACKAGECONFIG += "static"

Because each Qt application includes all the required Qt libraries, builds can become overly large if you enable tests and examples for Qt modules. For this reason, you should disable the options ptest from DISTRO_FEATURES and tests and examples from PACKAGECONFIG in Qt module recipes. This ensures that tests and examples are not built for the Qt modules.

For building your application statically, see Linking to Static Builds of Qt

Building Your Own Qt Application

You can build your own Qt application with meta-qt6 by inheriting the correct class to your application recipe. After setting the usual SRC_URI, DEPENDS and other common bitbake variables, use qt6-qmake if you have a qmake project:

inherit qt6-qmake

or qt6-cmake if you have a CMake project using Qt:

inherit qt6-cmake

In case you need to give qmake additional arguments, you can use the EXTRA_QMAKEVARS_PRE variable:

EXTRA_QMAKEVARS_PRE += "CONFIG+=extra-args"

For CMake builds, you can use the EXTRA_OECMAKE variable

EXTRA_OECMAKE += "-DFEATURE_EXTRA=ON"

Toolchain

The meta-qt6 layer includes an example SDK recipe (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 without sourcing the environment-setup file continues to be supported as it already is with meta-qt5.

Additionally, meta-mingw support is added to the meta-qt6 layer, which allows you to build toolchains that can be run natively on a Windows host. 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.

To create your own toolchain recipe, you can use the populate_sdk_qt6_base.bbclass to include the needed configutations.

Switching from meta-qt5 to meta-qt6 for building Qt or your own application should be quite straightforward. The recipes for Qt modules are using the same names in both layers, and starting with Qt 6.2, most of the modules from Qt5 are available in Qt6.

The two main bbclasses used in application recipes have changed:

meta-qt5meta-qt6
inherit qmake5inherit qt6-qmakefor building qmake project
inherit cmake-qt5inherit qt6-cmakefor building CMake project

Qt 6 is now using CMake for building itself, but qmake remains supported for application development, so you can keep your application builds using qmake.

Using meta-qt6 | Boot to Qt 6.7.2 (2024)

FAQs

What is the current version of qt6? ›

The latest version of the Qt Framework is Qt 6.7, which was released on April 2, 2024.

What is boot to qt? ›

Boot to Qt is a lightweight, Qt-optimized, full software stack for embedded Linux systems that is installed into the actual target device. The Boot to Qt Software Stack uses the traditional embedded Linux kernel built with Poky, the reference distribution of Yocto Project.

How to create boot to qt image? ›

How to Create Boot to Qt Image
  1. cd <BuildDir> repo init -u https://code.qt.io/yocto/boot2qt-manifest -m <manifest> repo sync.
  2. export MACHINE=imx8qm-mek source ./setup-environment.sh.
  3. bitbake meta-b2qt-embedded-qbsp.
  4. bitbake b2qt-embedded-qt6-image bitbake meta-toolchain-b2qt-embedded-qt6-sdk.

What is meta qt5? ›

meta-qt5 is a Yocto compatible meta layer that provides recipes for Qt modules.

Does anyone use Qt anymore? ›

Qt is only popular is C++ cross-platform GUI development. If you are working on applications that do not have a GUI you are probably not going to use Qt because of the bloat Qt has. There are some people who use Qt for protect build, but that is a small group when compared to people who use CMAKE, make, or msbuild.

Is Qt 6 backwards compatible? ›

Compatibility: Qt6 is designed to be backwards-compatible with previous versions, which means that OEMs can migrate their GUIs to Qt6 without having to completely rewrite their code.

What image format does Qt support? ›

The core Qt Gui library by default supports reading and writing image files of the most common file formats: PNG , JPEG , BMP , GIF and a few more, ref. Reading and Writing Image Files. The Qt Image Formats add-on module provides optional support for other image file formats.

How to setup Qt on Windows? ›

For more information, visit the Getting Started with Qt page.
  1. Step 1: Install the License File (Commercially Licensed Qt Only) ...
  2. Step 2: Unpack the Archive. ...
  3. Step 3: Set the Environment Variables. ...
  4. Step 4: Build the Qt Library. ...
  5. Step 5: Build the Qt Documentation.

Is Qt6 better than Qt5? ›

The main difference is that the Qt5 version runs at framerates between 19 to 15 FPS, the Qt6 version runs at framerates between 14 and 10 FPS.

Is Qt6 compatible with Qt5? ›

The semantics of the CMake API in Qt 5 and Qt 6 are largely compatible.

What is the difference between Qt5 and Qt6 Anki? ›

Qt5 vs. Qt6

The Qt6 version is recommended for most users. Advantages of the Qt6 version: Various bugfixes, including things like better support for less common languages. Very large images load faster than the Qt5 version.

Moving From Boot2Qt to Yocto with meta-qt6 | Qt ...Qt Forumhttps://forum.qt.io ›

Hello! We are using a Verdin i.MX8M Plus target device and are cross compiling on a Windows 10 machine with Qt Creator. During development, we had used Boot2...
I loaded qt6, finally on Mint Linux, but now I cannot use it. (1) Trying to run a example program, but there are no kits available and the documentation lead...
The new meta layer needs to contain information of all BSP (Board Support Package) meta layers that provide Yocto support for the selected devices. Also, the me...

What is the latest version of Qt for Linux? ›

The latest version of Qt for Linux is Qt 6.5 LTS, which was released on April 2023.

How do I find my current Qt version? ›

To view the installed Qt versions, select Preferences > Kits > Qt Versions. To view detailed information about each Qt version, select it in the list and select Details in the Qt version for section.

Is Anki Qt5 better than Qt6? ›

Qt5 vs. Qt6

Recent Anki versions come in separate Qt5 and Qt6 variants. The Qt6 version is recommended for most users. Advantages of the Qt6 version: Various bugfixes, including things like better support for less common languages.

What is current Qt? ›

The current QT program has been in effect since mid-2022 and has sought to reduce the Fed's assets by a maximum of $95 billion per month.

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Msgr. Refugio Daniel

Last Updated:

Views: 5293

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.