I'm using meta-toolchain-qt6
to generate my SDK for an arm64 processor.
Creating a simple Unit Test app for it using CMake.
My idea here was to use Qemu for running the unit tests pointing to the SDK like qemu-aarch64 -L $SDKTARGETSYSROOT <path/to/unit-test>
as I already used before for plain C++ apps without any graphical interface. I get:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
qt.qpa.plugin: Could not find the Qt platform plugin "eglfs" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted
Or just running ctest
, however CTest fails as (I think) runs from an x86_64
arch, and it fails with Syntax error: Unterminated quoted string
. If I changed the amount of tests even goes to ELF@: not found
Note: If I compile it for x86_64 everything goes well.
Note2: I'm using WSL2, however this was not an issue when compiling from x86_64, the application also launches perfectly under WSL2.
Should I consider adding CMake/CTest for ARM64 into the SDK? Is there something else I'm missing on the CMake config?
After some discussion on Qt forum here.
If you want to run unit tests of a plain Qt app using a Yocto SDK (not Qmls, without ctest
).
This command should suffice: qemu-aarch64 -L $SDKTARGETSYSROOT -E QT_QPA_PLATFORM_PLUGIN_PATH=$SDKTARGETSYSROOT/usr/lib/plugins <path-to/testing-bin>
The issue was that Qt was not able to find the platform shared libs, because it was only looking into the testing path itself and not on the SDK sysroot. Hence, setting the QT_QPA_PLATFORM_PLUGIN_PATH
variable.