Issue with building a qt application using qt6 in yocto

Hi,
I have created a OE environment by following the guide Building Toradex reference from scratch. From that I removed meta - qt5 layer and added meta-qt6 layer.When I tried to build a Qt application using qt6-qmake, I got error message as :expressionless: Could not find qmake spec ‘linux-oe-g++’.

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

The error message you’re encountering, “Could not find qmake spec ‘linux-oe-g++’,” typically indicates that the Qt configuration is unable to locate the mkspecs directory or the specific mkspec for your target environment. This is a common issue when transitioning from Qt5 to Qt6 in a Yocto/OE environment, as the paths and configurations can differ between these versions.

Here are a few steps to troubleshoot and potentially resolve this issue:

  1. Ensure the meta-qt6 Layer Configuration: Double-check that the meta-qt6 layer has been correctly added to your bblayers.conf file and that there are no conflicts or missing dependencies that might affect the Qt6 setup.

  2. Mkspecs Path: In Qt6, the location and handling of mkspecs might have changed compared to Qt5. Verify that the linux-oe-g++ mkspec exists within your Qt6 environment. Typically, this would be located in a path similar to <qt6-installation-dir>/Qt6.*/mkspecs/. If you’re building Qt6 from source or through Yocto, the path might be different, and you may need to specify the mkspecs path explicitly when invoking qmake.

  3. Environment Variables: When you source the environment setup script (as mentioned in your context), it sets up various environment variables necessary for cross-compilation, including paths to the compiler and mkspecs. After sourcing the script, verify that the environment variables related to Qt (such as OE_QMAKE_CXX and others) are correctly pointing to your Qt6 installation paths. You might need to adjust these variables to reflect the Qt6 structure.

  4. Qmake Invocation: When running qmake, you can specify the mkspecs directory manually using the -spec option. For example:

    qmake -spec <path-to-mkspecs>/linux-oe-g++ ...
    

    Replace <path-to-mkspecs> with the actual path to the mkspecs directory in your Qt6 installation.

  5. Check for Qt6 Compatibility: Ensure that your application’s code and project files are compatible with Qt6. There are several changes and deprecated features moving from Qt5 to Qt6 that might require adjustments in your code or project configuration.

If after these steps you’re still facing issues, it might be helpful to look into the detailed build logs for

Please, also check if these links can help you solve your problem:

How to set up Qt Creator to cross compile for embedded Linux | Toradex Developer Center.

Hi @SruthiSathyan ,
What branch are you working on?
Were you able to generate SDK?
Can you share the exact steps you are following ?

1.I have created OE environment by following the guide " Building Toradex reference from scratch" and even build the tdx-Reference Multimedia Image.
2. I have cloned meta-qt6 6.6.3 branch from git and added the meta-qt6 layer in bblayers.conf and also removed meta-qt5 from bblayers.
3.After that I tried to build a qt6 application called automotive.On building I got error as - Could not find qmake spec ‘linux-oe-g++’

Hi @SruthiSathyan,
Unfortunately, we have not tested meta-qt6 layer.
If you want to use qt6 you can use Torizon where qt6 container is already available.

Hi ,I have builded tdx-reference-multimedia-image with meta-qt6 layer added successfully. But when I try to build a qt6 project using qt6-qmake I got error as “Could not find qmake spec ‘linux-oe-g++”.
When I try to build it using qt6-cmake , I got error as – Could NOT find Qt6Quick (missing: Qt6Quick_DIR)

CMake Error at CMakeLists.txt:15 (find_package):
Found package configuration file:

/home/shanmugapriyan/oe-core/build/tmp/work/cortexa72-cortexa53-tdx-linux/automotive/1.0-r0/recipe-sysroot-native/usr/lib/cmake/Qt6/Qt6Config.cmake

but it set Qt6_FOUND to FALSE so package “Qt6” is considered to be NOT
FOUND. Reason given by package:

Failed to find required Qt component “Quick”.

Hi @SruthiSathyan ,
We have already update this thread with the answer

Hi, we were able to run a qt6 application in reference-multimedia-image by using meta-qt6 layer.

Hi @SruthiSathyan,
Nice to hear that you were able to test it.
If you want you can update the fix here so that it is benificial to others as well.