我的设置
在 Debian 7.8 上,我使用Yocto Poky为Raspberry Pi 2构建了自己的 Linux + Qt 5.4 + QtWebEngine + QML 插件分发。
在此处查看出色的Embarcados 教程
mkdir -p ~/yocto/dl
cd ~/yocto
git clone -b fido git://git.yoctoproject.org/poky poky
cd poky
git clone git://git.yoctoproject.org/meta-raspberrypi
git clone -b fido https://github.com/meta-qt5/meta-qt5.git
git clone -b fido git://git.openembedded.org/meta-openembedded
git clone -b fido https://bitbucket.org/embarcados/meta-embarcados.git
配置
otto@marvin:~/yocto/build$ vi ~/yocto/build/conf/bblayers.conf
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
${TOPDIR}/../poky/meta-embarcados \
${TOPDIR}/../poky/meta-embarcados/meta-rpi \
${TOPDIR}/../poky/meta-raspberrypi \
${TOPDIR}/../poky/meta-qt5 \
${TOPDIR}/../poky/meta-openembedded/meta-oe \
${TOPDIR}/../poky/meta-openembedded/meta-ruby \
/home/otto/yocto/poky/meta \
/home/otto/yocto/poky/meta-yocto \
/home/otto/yocto/poky/meta-yocto-bsp \
"
BBLAYERS_NON_REMOVABLE ?= " \
/home/otto/yocto/poky/meta \
/home/otto/yocto/poky/meta-yocto \
"
在/home/otto/yocto/build/conf/local.conf
添加MACHINE = "raspberrypi2"
为图像添加了 QtWebEngine + QML 插件
vi ../poky/meta-embarcados/meta-rpi/recipes-core/images/qt5-image-demo.bbappend
IMAGE_INSTALL += "\
packagegroup-qt5-machine-related \
qtwebengine \ => /usr/lib/qt5/libexec/QtWebEngineProcess
qtwebengine-qmlplugins \ => /usr/lib/qt5/qml/QtWebEngine
"
构建图像
cd ~/yocto
. poky/oe-init-build-env build
bitbake qt5-image-demo
运行我的简单 QML
root@raspberrypi2:~# more chromium.qml
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtWebEngine 1.0
ApplicationWindow {
width: 640
height: 480
color: "lightgray"
visible: true
WebEngineView {
id: webview
url: "file:///home/root/hello.html"
anchors.fill: parent
}
}
错误
root@raspberrypi2:~# /usr/bin/qt5/qmlscene chromium.qml --platform eglfs
file:///home/root/chromium.qml:3 plugin cannot be loaded for module "QtWebEngine": Cannot load library /usr/lib/qt5/qml/QtWebEngine/libqtwebengineplugin.so: (/usr/lib/libexpat.so.1: invalid ELF header)
任何指针?说明了什么invalid ELF header
?