将 qcharts 模块安装到 yocto sdk [英] install qcharts module to yocto sdk
问题描述
我尝试交叉编译 qt 图表示例对于 yocto 平台.我执行以下步骤来编译我的 qt 程序:
I try to cross-compile qt chart example for a yocto platform. I do following steps to compile my qt programs:
- source/opt/myimage/2.1.2/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
- qmake -o Makefile areachart.pro
- 制作
但是当我将 QT += charts
添加到任何运行 qmake 的项目时,例如 qmake -o Makefile areachart.pro
我遇到了这个错误:项目错误:QT 中的未知模块:图表
这是 qmake -v
的输出:
But When I add QT += charts
to any project run qmake like qmake -o Makefile areachart.pro
I hit this error:
Project ERROR: Unknown module(s) in QT: charts
Here is the output of qmake -v
:
QMake version 3.0
Using Qt version 5.7.0 in /opt/myimage/2.1.2/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib
我应该添加 qtcharts
模块我的 yocto SDK 能够编译示例吗?如果是,如何?
Should I add qtcharts
module my yocto SDK to be able to compile the example? if yes how?
由于某些原因,我能够使用 qtcreator<交叉编译 Qt from source/code> 并获取 qt 示例和 qtchart 库本身的二进制文件.我还在目标平台上运行 qt 示例,方法是将结果
libQtCharts.so
和其他文件手动放入 /usr/lib/
和 /usr/include/
在目标上,我能够在目标上绘制图表.
For some reasons I was able to cross-compiled Qt from source using qtcreator
and get the binary files for qt examples and qtchart library itself. I also run the qt examples on my target platform by putting resulting libQtCharts.so
and other files manually in /usr/lib/
and /usr/include/
on the target and I was able to draw the charts on target.
但是,我需要的是在我的项目中包含图表并运行上述 qmake
步骤.但我得到的是 Project ERROR: Unknown module(s) in QT: charts
我试图将我从手动编译 qt 源代码中得到的 libQtCharts.so
放在 /opt/myimage/2.1.2/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib
但仍然无法使用 qmake -o Makefile areachart.pro
However, what I need is to include the charts in my project and run qmake
steps as mentioned above. But what I get is the Project ERROR: Unknown module(s) in QT: charts
I have tried to put libQtCharts.so
which I got from compiling qt source manually in /opt/myimage/2.1.2/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib
but still not able to get the make file with qmake -o Makefile areachart.pro
推荐答案
正如你所指出的,你需要 qtcharts
包(也需要 qtcharts-dev
来精确)在您的 SDK 中.您还需要在目标上(即在您的图像中)qtcharts
包,否则当您在目标上执行二进制文件时,运行时库将丢失.
As you pointed out, you need qtcharts
package (also with qtcharts-dev
to be precise) in your SDK. You also need qtcharts
package on your target (i.e. in your image), otherwise the runtime library will be missing when you will execute your binary on the target.
包的添加取决于构建SDK的方法.首选是 populate_sdk
任务,因此我将在此处对其进行描述(它还会将包添加到您的目标中).
The addition of the package depends on the method of building the SDK. The preferred one is a populate_sdk
task, so I will describe it here (it will also add the package to your target).
构建 SDK 的命令是 bitbake your_image -c populate_sdk
.将以下几行添加到 your_image.bb
配方以将 qtcharts
包添加到图像(第 1 行)和 SDK 的其他 Qt5 内容(第 2 行).
The command to build the SDK is bitbake your_image -c populate_sdk
. Add following lines to your_image.bb
recipe to add the qtcharts
package to the image (line 1) and other Qt5 stuff for SDK (line 2).
IMAGE_INSTALL += "qtcharts"
inherit populate_sdk_qt5
如果您不想直接编辑图像配方,也可以将这些行放入 your_image.bbappend
.
You can also put these lines into your_image.bbappend
if you don't want to edit the image recipe directly.
inherit populate_sdk_qt5
是 Qt5 包特有的(并且是必需的),因为 SDK 需要其他东西(例如 qt.conf
,一些工具).
The inherit populate_sdk_qt5
is specific (and required) for Qt5 packages, because other stuff is needed for SDK (e.g. qt.conf
, some tools).
这篇关于将 qcharts 模块安装到 yocto sdk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!