Making my yocto image able to compile my qt project
-
Hi everyone,
I'm writing this post because I'm a kinda stuck on the last step of my school project. The objective is to run a qt project on a embedded nxp imx device. The Qt project is done and well running on my computer, the yocto image for the imx module is also working and is able to run the QtDemo file (the layers meta-qt5 is included in my yocto image). Now the last step for me is to include my qt project in this yocto image. I first thought about cross compilation but what I would like my system to do is to be able to compilethe project by itself and then run it and not just "simply" running an app cross-compiled by my pc. If anyone could help me on that particular case, that would be awesome.
Thanks !
-
Hi and welcome to devnet,
Do you mean make your application a part of your yocto build ?
-
Yes exactly. I'm actually making a recipe with my .pro file included in but I'm wondering if I also have to include in my recipe all the Headers and stuff of my code (like in the .pro file). Also, I just discovered "boot2qt" and I'm wondering if it could help me to get my board to boot directly on my qt app ? That would be awesome.
Thanks for answering me so quickly and for your support :) -
AFAIR, the idea is that your recipe will build your project so it needs to be complete in order to be built just the .pro file is not enough.
The recipe basically will call qmake, make, make install
-
@SGaist Hi, thanks for your help, I successfully integrated my app in my yocto build and the end end last week :) Thanks for your reply anyway, I'm now sure that what I did was the good way ! Thanks ! Last question for you if possible : My Qt app is in my yocto image but when I try to launch it, I have an error that says : "Failed to load translation : /translation/myapp_C.qm " whereas none of the project files are named like this nor are listed in my pro/bb file.... If you have any idea on why Qt is looking for this file only in the yocto version (project is working fine on Qt Creator), that would be awesome.
EDIT : Found out that the application default language was not the one I wanted, that's what the translation file was wrong. Everything for this part is fine now !
-
@kmarconi said in Making my yocto image able to compile my qt project:
I successfully integrated my app in my yocto build
Great! so could you mark this post as solved then?
-
@Pablo-J-Rogina Was about to do it but I got a last question if it's possible. I would like to know the way to include image files like png or svg in my recipe ? For the moment, i'm doing it with the SRC_URI += instruction but on the embedded side, there is none of the file I would like to find. I'm I doing it wrong ?
Edit : Adding FILE_${PN} += "path to my directory" seems to be the way
-
@kmarconi said in Making my yocto image able to compile my qt project:
I would like to know the way to include image files like png or svg in my recipe ?
I cannot help with Yocto recipes to "bake" those files into the image, but another approach is to add those images into the Qt resource system, making them part of your app executable
-
@Pablo-J-Rogina I successfully added them to my yocto image, thanks. The thing is that I don't know how to tell my app in the yocto part where to look for these files. In fact, in Qt creator, my app knows that by reading my qrc files and by using "qrc:/...." paths, it will be able to use any kind of files listed in these qrc files. But on the yocto side, I'm not sure that the binary of my app is able to find all these paths. The thing which is telling me this is that I always have this error on my yocto image when i launch the app :
QQmlCOmponent : Component is not ready
qml : actionView test for Vid? is null
QQmlComponent : Component is not ready
qml : action imageTest for Image is null
qt.qpa.xcb : xcb_shm_create_segment() failed for size 1228800
Segmentation faultIs there a specific way to tell yocto or qt where to find the files he needs on the yocto side ? Thanks .
-
Is this coming from your own files ?
Does your image contain all the QtQuick stuff you are using ? -
@SGaist What do you mean by your own files ? If it's about the qml : action error, yes I think it's from my files. In fact, I have an action called imageTest, and it requires a file which is registered in my qrc files and the way to get it is by using the qrc path ("qrc:/myfile.png"). I think that the qml is not able to use this qrc path on the yocto image side and that's why it is saying that the Component is not ready. ( correct me if I'm wrong)
And about QtQuick, do you have a list of all the qtquick package that we can install ?For the moment, I have included qtquicontrols2 in my recipe with qtquickcontrols2 and qtquickcontrols2-mkspecs in my RDEPENDS flag.
Thanks again !
-
No I don't have such a list.
What I would do is to check that you build all the Qt modules that are related to your QT += entries.
qrc paths should just work because these files are built in your executable.
-
@SGaist Thanks for your support again,will try it out today and then come back here asap
Edit : I'm using QT += qml quick gui in my .pro, what should I include on the yocto side ? (more than what I actually have in my DEPENDS : qtbase qtdeclarative qtquickcontrols2) . Also, here is my RDEPENDS :
RDEPENDS_${PN} += "
qtvirtualkeyboard
gstreamer1.0-plugins-base
gstreamer1.0-plugins-good
qtquickcontrols2
qtquickcontrols2-mkspecs
qtquickcontrols2-qmlplugins
"Thanks !
-
EDIT: Problem is solved, I was missing the qtmultimedia package. Now I have this error (hope to be the last one : QML Image : Cannot open : qrc:/image/test.jpg) whereas I have the qrc file which include this jpg file ...
EDIT(2) : All my files are now well found by the app, it was a problem of relative path. Now I need to fix the : qt.qpa.xcb : xcb_shm_create_segment() failed for size 1228800 error and it will finally run I wish...
After running gdb on my apps, it seems to be a problem linked with Qt and OpenGL ( I have the segmentation fault coming from : QOpenGLContext::shareGroup() const () from /usr/lib/libQt5Gui.so.5)
-
@kmarconi said in Making my yocto image able to compile my qt project:
QML Image : Cannot open : qrc:/image/test.jpg
Could it be possible your yocto image is missing the Qt Image plugins?
You should deploy the JPG plugin at least to your device from the <Qt_installation_folder>/plugins/imageformats folder -
Hi, thanks for your reply . Yeah I was missing the Qtmultimedia package but also some my path in my qrc files were wrong.
I'm now working on the segmentation fault : qt.qpa.xcb : xcb_shm_create_segment() failed for size 1228800 which I have everytime I launch my app ... As I said in my earlier message, after running gdb on my apps, it seems to be a problem linked with Qt and OpenGL ( I have the segmentation fault coming from : QOpenGLContext::shareGroup() const () from /usr/lib/libQt5Gui.so.5)
-
Is there anything in your Yocto recipe to manage the OpenGL setup of your device ?
-
@SGaist I don't think so but in the meantime I don't see any package which could do it. My board support OpenGl ES2 so I tried some stuff like adding "PACKAGE CONFIG += "gles2" " to my qtbase bb file but nothing has changed ...
Also tried to add PACKAGECONFIG_append_pn-qtbase = "gles2" in my local.conf but no change.
After some googling, I found that the error was printed by this code : https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/xcb/qxcbbackingstore.cpp?h=dev (line 371)
Edit: Closing this issue, it was a problem of platform (by default it was using x11 which is not the one used by my embedded device) . Thanks a lot for your help again !