添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Context

I'd like to run a Qt application on an IM6 based system with a Yocto built image. I already have the meta-qt5 layer in my project. I started with a simple Qt5 application that only neededs the following modules:

QT += core gui widgets

All I have to do is make sure my bitbake recipe has DEPENDS += qtbase and is based on the qmake class with: inherit qmake5. And it builds and runs on the target! No problem

Problem

Now I'd like to add another Qt5 application, this time with the following modules and one plugin:

QT += core gui widgets    quick qml svg xml network charts
QTPLUGIN += qsvg

Unfortunately, I'm not able to simple add these to my DEPENDS variable and get it to work. But googling around for how to add support reveals what seems to be a sprawling assortment of solutions. I'll enumerate what I've found here:

  • I need to add inherit populate_sdk_qt5 to instruct bitbake to build the recipe against the SDK that contains the libraries for the modules (see here)
  • I need to add IMAGE_FEATURES += dev-pkgs to the recipe (see here)
  • I need to modify local.conf for the system, and add lines like: PACKAGECONFIG_append_pn_qttools = "..." and also PACKAGECONFIG_append_pn-qtbase = "..."
  • I need to modify layer.conf in my layer and add things like IMAGE_INSTALL_append = "qtbase qtquick ..." (slide 53 here)
  • I need to manually patch the Qt5 toolchain for charts? (see here)
  • I need to compile my image using bitbake <target> -c populate_sdk? (see here again)
  • At this point, I'm really unsure what exactly is going on. It seems we're modifying the recipe, the layer configuration file, the distribution configuration file, and even meta-Qt layer files. I know that I fundamentally need to do a few things:

  • Compile the application against the Qt5 SDK
  • Compile the needed plugins + modules for the target architecture
  • Make sure the appropriate binaries (images) are copied to the target.
  • But it has become a bit unclear about what does what. I know that IMAGE_INSTALL_append adds images to the target, but I am lost with what is the proper way to add the modules. I don't want to go about randomly adding lines, so I'm hoping someone can clear up a bit what exactly I need to be looking at in order to add support for a Qt5 module for an application.

    @OleksandrKravchuk I can attempt what was done in the answer, but the OP did not signal it worked for them (did not mark question answered and comments inconclusive). Is this a method you believe will work? – Micrified Apr 26, 2021 at 14:46

    There are different problems stated, your preferred way seems to the directly building a recipe, not using the toolchain. So, you need the image to have the tools you need.

    First of all qtsvg is not on Qt Base, it is a module so you need it installed.

    Add Qt SVG support

    You need Qt SVG on target in order to run your App. Either to your image or to local.conf you need

    IMAGE_INSTALL_append = " qtsvg" 
    

    As a fact, your app's recipe needs Qt QSVG so you need to DEPEND on it on your app's recipe like this:

    DEPENDS = "qtsvg"
    

    here qtsvg is the name of the other recipe, namely qtsvg_git.bb, not to be confused with the identically named qtsvg plugin. And it will get pulled automatically on build time on your development machine, otherwise it won't even build.

    Remember yocto creates a simulated image tree on the TMP folder in order to build (yes it does it for each recipe), so you must describe what your recipe needs or it won't find it and your build will fail.

    You can also check the recipe for a Qt5 example as it also has DEPENDS and RDEPENDS. And you can get more info on those in here.

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.