Running cross compiled unit tests with qemu (from yocto SDK)
-
To build a Qt app within WSL and run it (x86_64), I followed this link, and it went well, it launches, however I'm relying on X, not Wayland. Couldn't find anything explaining what dependencies I need for Wayland.
Then I moved towards cross-compiling. Created this question on StackOverflow
Basically I'm getting
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
Seems like, as my image/SDK won't have any X, I can't rely on xcb. What dependencies I need to add to my SDK to be able to simply run the Unit Tests under qemu?
-
@SGaist
When I did that (passing to qemu), I still get the same thing, only the first line is new:qemu-aarch64 -L $SDKTARGETSYSROOT -E QT_DEBUG_PLUGINS=1 install/Debug/bin/appExample QFactoryLoader::QFactoryLoader() checking directory path "<path-to-app>/install/Debug/bin/platforms" ... 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
There's nothing installed in
/bin/platforms
, but also there's not installed on x86_64 as well, and still loads successfully. -
@SGaist AFAIK my question can be silly as well :)
My main question is, given an SDK generated by Yocto (that is used to compile a Qt application and its UTs) how can I run the Unit Tests using only qemu? (If this was a plain Cpp app, the line I used to run it would suffice)
So, yeah, the sysroot where the qemu lives, and it uses has Qt.
I tried now to copy the
platforms/
folder under/opt/sdk-folder/0.0.1/sysroot/.../usr/lib/plugins/platforms/
to the path it says it was trying to reach(where I built it), and it works. Do you know which env variable Qt uses to look for it? Then I might be able to correctly set it up! -
For anyone that came here trying to manually run Qemu unit tests (without booting up an image) for Qt:
qemu-aarch64 -L $SDKTARGETSYSROOT -E QT_QPA_PLATFORM_PLUGIN_PATH=$SDKTARGETSYSROOT/usr/lib/plugins <path-to/testing-bin>
Works!
Note: I don't know if that's the best solution, and it might be the case that there's a cleaner solution though :) Please improve it
Note2: This forces you to run it manually, not withctest
. Ideas on how to run it through ctest are welcome.Take into account that this is also a simple solution. And only works for plain Qt, qmltests are still not working.