本文介绍了如何安装 &运行 QML QtWebEngine &SBC 上的 QtWebKit 使用 Yocto/无法从任何来源获取 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • Debian GNU/Linux 7.8 (wheezy) Linux marvin 3.16-0.bpo.2-amd64 #1 SMP Debian 3.16.3-2~bpo70+1 (2014-09-21) x86_64 GNU/Linux
  • 树莓派 2
  • Yocto Poky
  • Qt5

我希望能够在我的 RPi2 上运行它:

I want to be able to run this on my RPi2:

import QtQuick 2.1
import QtQuick.Controls 1.1
import QtWebEngine 1.0

ApplicationWindow {
    width: 1280
    height: 720
    visible: true
    WebEngineView {
        id: webview
        url: "http://www.qt-project.org"
        anchors.fill: parent
    }
}

我是如何创建 RPi2 图像的

我使用 这个独特而精彩的葡萄牙语教程英文版

在几行之后,我如何为我的 RPi2 生成图像

here after in a few line how I was able to generate a image for my RPi2

mkdir -p ~/yocto/dl
cd ~/yocto
git clone -b dizzy git://git.yoctoproject.org/poky poky-dizzy
cd poky-dizzy
git clone git://git.yoctoproject.org/meta-raspberrypi
git clone -b dizzy https://github.com/meta-qt5/meta-qt5.git
git clone -b dizzy git://git.openembedded.org/meta-openembedded
git clone -b dizzy https://bitbucket.org/embarcados/meta-embarcados.git

然后

cd ~/yocto
. poky-dizzy/oe-init-build-env build-dizzy
bitbake qt5-image-demo

几个小时后我可以选择构建的图像~/yocto/build-dizzy/tmp/deploy/images/raspberrypi2/qt5-image-demo-raspberrypi2.rpi-sdimg

after a few hours I could pick the image built ~/yocto/build-dizzy/tmp/deploy/images/raspberrypi2/qt5-image-demo-raspberrypi2.rpi-sdimg

...并复制到 microSD 卡,例如

... and copy to a microSD card e.g.

dd if=~/yocto/build-dizzy/tmp/deploy/images/raspberrypi2/qt5-image-demo-raspberrypi2.rpi-sdimg of=/dev/sdbX bs=4M

问题:未安装 QtWebEngine

...但是当我尝试运行这个 简单的 QtWebEngine 示例 我收到一条错误消息,指出未安装 QtWebEngine:

root@raspberrypi2:~# /usr/bin/qt5/qmlscene qb.qml -platform eglfs
file:///home/root/qb.qml:3 module "QtWebEngine" is not installed

...所以我添加了 QtWebEngine recipe到我的 bitbake 图像配置并在我的图像配置中运行

... so I added QtWebEngine recipe to my bitbake image configuration and ran in my image configuration

vi ../poky-dizzy/meta-embarcados/meta-rpi/recipes-core/images/qt5-image-demo.bbappend

IMAGE_INSTALL += "\
           packagegroup-qt5-machine-related \
           apt \
           openssh \
           qtwebengine \                   => /usr/lib/qt5/libexec/QtWebEngineProcess
           qtwebengine-qmlplugins \        => /usr/lib/qt5/qml/QtWebEngine
                        "

错误 - RESOLVED

~/yocto/build-dizzy$ bitbake qt5-image-demo
WARNING: Host distribution "Debian-7.8" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache: 100% |##########################################################################################################################################################################################| ETA:  00:00:00
Loaded 1952 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.24.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Debian-7.8"
TARGET_SYS        = "arm-poky-linux-gnueabi"
MACHINE           = "raspberrypi2"
DISTRO            = "poky"
DISTRO_VERSION    = "1.7.2"
TUNE_FEATURES     = "arm armv7a vfp thumb neon callconvention-hard vfpv4 cortexa7"
TARGET_FPU        = "vfp-vfpv4-neon"
meta-embarcados
meta-rpi          = "dizzy:821ba371852d2aa86bc71d75918df37a21d264ad"
meta-raspberrypi  = "master:6ef9d94a2c2588dcefe442577ef6ae5bbe722dec"
meta-qt5          = "dizzy:adeca0db212d61a933d7952ad44ea1064cfca747"
meta-oe           = "dizzy:5b6f39ce325d490fc382d5d59c5b8b9d5fa38b38"
meta
meta-yocto        = "dizzy:9c4ff467f66428488b1cd9798066a8cb5d6b4c3b"
meta-ruby         = "dizzy:5b6f39ce325d490fc382d5d59c5b8b9d5fa38b38"

NOTE: Preparing runqueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: Failed to fetch URL git://code.qt.io/qt/qtwebengine.git;branch=1.0, attempting MIRRORS if available
ERROR: Fetcher failure: Unable to find revision 21f6ce84ecca9a4ff2aa980b21d2e5174c78d14b in branch 1.0 even from upstream
ERROR: Function failed: Fetcher failure for URL: 'git://code.qt.io/qt/qtwebengine.git;branch=1.0'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /home/otto/yocto/build-dizzy/tmp/work/cortexa7t2hf-vfp-vfpv4-neon-poky-linux-gnueabi/qtwebengine/5.3.2-r0/temp/log.do_fetch.16064
ERROR: Task 634 (/home/otto/yocto/build-dizzy/../poky-dizzy/meta-qt5/recipes-qt/qt5/qtwebengine_5.3.2+git.bb, do_fetch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3306 tasks of which 3305 didn't need to be rerun and 1 failed.
No currently running tasks (1955 of 3321)

Summary: 1 task failed:
  /home/otto/yocto/build-dizzy/../poky-dizzy/meta-qt5/recipes-qt/qt5/qtwebengine_5.3.2+git.bb, do_fetch
Summary: There were 2 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

日志

~/yocto/build-dizzy$ tail /home/otto/yocto/build-dizzy/tmp/work/cortexa7t2hf-vfp-vfpv4-neon-poky-linux-gnueabi/qtwebengine/5.3.2-r0/temp/log.do_fetch.16064
DEBUG: Running export PATH="/home/otto/yocto/build-dizzy/tmp/sysroots/x86_64-linux/usr/bin/qt5:/home/otto/yocto/build-dizzy/tmp/sysroots/x86_64-linux/usr/bin/python-native:/home/otto/yocto/build-dizzy/tmp/sysroots/x86_64-linux/usr/bin/perl-native:/home/otto/yocto/poky-dizzy/scripts:/home/otto/yocto/build-dizzy/tmp/sysroots/x86_64-linux/usr/bin/arm-poky-linux-gnueabi:/home/otto/yocto/build-dizzy/tmp/sysroots/raspberrypi2/usr/bin/crossscripts:/home/otto/yocto/build-dizzy/tmp/sysroots/x86_64-linux/usr/sbin:/home/otto/yocto/build-dizzy/tmp/sysroots/x86_64-linux/usr/bin:/home/otto/yocto/build-dizzy/tmp/sysroots/x86_64-linux/sbin:/home/otto/yocto/build-dizzy/tmp/sysroots/x86_64-linux/bin:/home/otto/yocto/poky-dizzy/scripts:/home/otto/yocto/poky-dizzy/bitbake/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"; export HOME="/home/otto"; /usr/bin/env wget -t 2 -T 30 -nv --passive-ftp --no-check-certificate -P /home/otto/yocto/build-dizzy/../dl 'http://sources.openembedded.org/git2_code.qt.io.qt.qtwebengine.git.tar.gz'
DEBUG: Mirror fetch failure for url http://sources.openembedded.org/git2_code.qt.io.qt.qtwebengine.git.tar.gz (original url: git://code.qt.io/qt/qtwebengine.git;branch=1.0)
DEBUG: Fetcher failure: Fetch command failed with exit code 8, output:
http://sources.openembedded.org/git2_code.qt.io.qt.qtwebengine.git.tar.gz:
2015-05-24 03:12:49 ERROR 404: Not Found.

ERROR: Fetcher failure: Unable to find revision 21f6ce84ecca9a4ff2aa980b21d2e5174c78d14b in branch 1.0 even from upstream
DEBUG: Python function base_do_fetch finished
DEBUG: Python function do_fetch finished
ERROR: Function failed: Fetcher failure for URL: 'git://code.qt.io/qt/qtwebengine.git;branch=1.0'. Unable to fetch URL from any source.

确实这给了我一个404,这是我的问题

indeed this give me a 404 and that's my issue

http://sources.openembedded.org/git2_code.qt.io.qt.qtwebengine.git.tar.gz`

但我检查了这个并且它有效

but I check this and it works

git clone git://code.qt.io/qt/qtwebengine.git;branch=1.0git://code.qt.io/qt/qtwebengine.git;branch=1.0`

没有人知道如何解决这个问题吗?

Doesn't anyone know how to fix this?

事实上,我对 QtWebKit 有同样的问题

解决了 QtWebEngine 的编译/安装部分.我能够编译 QtWebEngine /usr/lib/qt5/libexec/QtWebEngineProcess.简单的 QML 脚本仍然没有找到 QtWebEngine,我认为它期待的是我无法生成的 /usr/lib/qt5/qml/QtWebEngine.

Compilation/Installation part of QtWebEngine was addressed. I was able to compile the QtWebEngine /usr/lib/qt5/libexec/QtWebEngineProcess. The simple QML script still doesn't find the QtWebEngine, I think it is expecting /usr/lib/qt5/qml/QtWebEngine which I am not able to generate.

QML 不是硬性要求.我只需要能够编译和运行一个非常简单的 Qt5 应用程序,该应用程序将加载具有 Chromium 布局引擎功能的网页,因此需要 QtWebEngine.

QML is not a hard requirement. I just need to be able to compile and run a very simple Qt5 application that will load a Web page with the Chromium Layout Engine capabilities hence the requirement of QtWebEngine.

root@raspberrypi2:~# /usr/bin/qt5/qmlscene --platform eglfs chromium.qml
file:///home/root/chromium.qml:3 module "QtWebEngine" version 1.0 is not installed

QtWebEngine 安装的文件

QtWebEngine Files installed

root@raspberrypi2:/usr/lib/qt5# find . -name *ngine*
./qml/QtWebEngine
./qml/QtWebEngine/experimental/libqtwebengineexperimentalplugin.so
./qml/QtWebEngine/libqtwebengineplugin.so
./plugins/iconengines
./plugins/mediaservice/libqtmedia_audioengine.so
./plugins/qtwebengine
./libexec/QtWebEngineProcess

看起来是 0.9

root@raspberrypi2:~# ls -al /usr/lib/libQt0Web*
lrwxrwxrwx    1 root     root            24 Jun  5 09:16 /usr/lib/libQt0WebEngine.so.0 -> libQt0WebEngine.so.0.9.0
lrwxrwxrwx    1 root     root            24 Jun  5 09:16 /usr/lib/libQt0WebEngine.so.0.9 -> libQt0WebEngine.so.0.9.0
-rwxr-xr-x    1 root     root        112744 May 24 19:04 /usr/lib/libQt0WebEngine.so.0.9.0
lrwxrwxrwx    1 root     root            28 Jun  5 09:16 /usr/lib/libQt0WebEngineCore.so.0 -> libQt0WebEngineCore.so.0.9.0
lrwxrwxrwx    1 root     root            28 Jun  5 09:16 /usr/lib/libQt0WebEngineCore.so.0.9 -> libQt0WebEngineCore.so.0.9.0
-rwxr-xr-x    1 root     root      32914884 May 24 19:04 /usr/lib/libQt0WebEngineCore.so.0.9.0
lrwxrwxrwx    1 root     root            31 Jun  5 09:16 /usr/lib/libQt0WebEngineWidgets.so.0 -> libQt0WebEngineWidgets.so.0.9.0
lrwxrwxrwx    1 root     root            31 Jun  5 09:16 /usr/lib/libQt0WebEngineWidgets.so.0.9 -> libQt0WebEngineWidgets.so.0.9.0
-rwxr-xr-x    1 root     root         73976 May 24 19:04 /usr/lib/libQt0WebEngineWidgets.so.0.9.0

将导入版本更改为 0.9 import QtWebEngine 0.9

现在得到一个不同的错误,但是一个空白的(白色然后红色)画布正在打开

Changed import version to 0.9 import QtWebEngine 0.9

Now getting a different error, but a blank (white then red) canvas is opening

root@raspberrypi2:~# /usr/bin/qt5/qmlscene --platform eglfs chromium.qml
[0605/112518:ERROR:resource_bundle.cc(607)] Failed to load /usr/share/qt5/qtwebengine_resources.pak
Some features may not be available.
[0605/112518:WARNING:resource_bundle.cc(280)] locale_file_path.empty()
[0605/112518:WARNING:proxy_service.cc(890)] PAC support disabled because there is no system implementation
[0605/112518:ERROR:resource_bundle.cc(607)] Failed to load /usr/share/qt5/qtwebengine_resources.pak
Some features may not be available.
[0605/112518:WARNING:resource_bundle.cc(280)] locale_file_path.empty()

确实没有 .pak 文件存在

root@raspberrypi2:/usr/share/qt5# ls -al
drwxr-xr-x    4 root     root          1024 Jun  5 09:27 .
drwxr-xr-x   29 root     root          1024 May 22 15:21 ..
drwxr-xr-x   40 root     root          1024 Jun  5 09:16 examples
drwx------    3 root     root          1024 Jun  5 09:27 translations

没有 QtWebEngine plugins.qmltypes (?)

No QtWebEngine plugins.qmltypes (?)

root@raspberrypi2:~# find /usr/lib -name plugins.qmltypes
/usr/lib/qt5/qml/QtQuick.2/plugins.qmltypes
/usr/lib/qt5/qml/QtMultimedia/plugins.qmltypes
/usr/lib/qt5/qml/Qt/labs/settings/plugins.qmltypes
/usr/lib/qt5/qml/Qt/labs/folderlistmodel/plugins.qmltypes
/usr/lib/qt5/qml/Qt/WebSockets/plugins.qmltypes
/usr/lib/qt5/qml/QtServiceFramework/plugins.qmltypes
/usr/lib/qt5/qml/Qt3D/plugins.qmltypes
/usr/lib/qt5/qml/Qt3D/Shapes/plugins.qmltypes
/usr/lib/qt5/qml/QtLocation/plugins.qmltypes
/usr/lib/qt5/qml/QtPositioning/plugins.qmltypes
/usr/lib/qt5/qml/Enginio/plugins.qmltypes
/usr/lib/qt5/qml/QtQuick/LocalStorage/plugins.qmltypes
/usr/lib/qt5/qml/QtQuick/Controls/plugins.qmltypes
/usr/lib/qt5/qml/QtQuick/Layouts/plugins.qmltypes
/usr/lib/qt5/qml/QtQuick/Particles.2/plugins.qmltypes
/usr/lib/qt5/qml/QtQuick/XmlListModel/plugins.qmltypes
/usr/lib/qt5/qml/QtQuick/Window.2/plugins.qmltypes
/usr/lib/qt5/qml/QtQuick/Dialogs/plugins.qmltypes
/usr/lib/qt5/qml/QtQuick/PrivateWidgets/plugins.qmltypes
/usr/lib/qt5/qml/QtSensors/plugins.qmltypes
/usr/lib/qt5/qml/QtNfc/plugins.qmltypes
/usr/lib/qt5/qml/QtSystemInfo/plugins.qmltypes
/usr/lib/qt5/qml/QtPublishSubscribe/plugins.qmltypes
/usr/lib/qt5/qml/QtTest/plugins.qmltypes
/usr/lib/qt5/qml/QtBluetooth/plugins.qmltypes

otto@marvin:~/yocto/build-dizzy$ find . -name  packages-split | grep webengine
./tmp/work/cortexa7t2hf-vfp-vfpv4-neon-poky-linux-gnueabi/qtwebengine/5.3.2-r0/packages-split

在我的构建机器上

otto@marvin:~/yocto/build-dizzy$ find . -name qtwebengine_resources.pak
./tmp/work/cortexa7t2hf-vfp-vfpv4-neon-poky-linux-gnueabi/qtwebengine/5.3.2-r0/packages-split/qtwebengine-dev/usr/share/qt5/qtwebengine_resources.pak
./tmp/work/cortexa7t2hf-vfp-vfpv4-neon-poky-linux-gnueabi/qtwebengine/5.3.2-r0/image/usr/share/qt5/qtwebengine_resources.pak
./tmp/work/cortexa7t2hf-vfp-vfpv4-neon-poky-linux-gnueabi/qtwebengine/5.3.2-r0/package/usr/share/qt5/qtwebengine_resources.pak
./tmp/work/cortexa7t2hf-vfp-vfpv4-neon-poky-linux-gnueabi/qtwebengine/5.3.2-r0/git/src/core/Release/gen/repack/qtwebengine_resources.pak
./tmp/work/cortexa7t2hf-vfp-vfpv4-neon-poky-linux-gnueabi/qtwebengine/5.3.2-r0/sysroot-destdir/usr/share/qt5/qtwebengine_resources.pak
./tmp/sysroots/raspberrypi2/usr/share/qt5/qtwebengine_resources.pak

简单 QML QtWebEngine 不显示网页关于 Stackoverflow 的问题

推荐答案

如果你看一下 repo git://code.qt.io/qt/qtwebengine.git,你会看到没有名为的分支1.0,这就是您的 bitbake 日志所述:

If you take a look at the repo git://code.qt.io/qt/qtwebengine.git, you'll see that there's no branch named 1.0, which is what your bitbake log states:

ERROR: Fetcher failure: Unable to find revision 21f6ce84ecca9a4ff2aa980b21d2e5174c78d14b in branch 1.0 even from upstream

如果我们克隆 qtwebengine 存储库,并运行以下命令,我们将了解哪个分支包含该提交.

If we clone the qtwebengine repo, and run the following command, we'll learn which branch contains that commit.

$  git branch -r --contains 21f6ce84ecca9a4ff2aa980b21d2e5174c78d14b
origin/5.4
origin/5.4.2
origin/5.5
origin/5.5.0
origin/HEAD -> origin/5.5
origin/dev

因此,该提交在例如 5.4 分支上可用.

Thus, that commit is available on e.g the 5.4 branch.

查看 meta-qt5 中的 qtwebengine_5.3.2ǵit.bb 配方,我们将在配方中看到以下行:

Having a look at the qtwebengine_5.3.2ǵit.bb recipe in meta-qt5, we'll see the following line in the recipe:

QT_MODULE_BRANCH = "1.0"

这一行将决定从上面的存储库检出哪个分支.

It's this line that will decide what branch to checkout from the repository above.

尝试在自己的层中添加一个qtwebengine_5.3.2+git.bbappend,在其中添加:

Try adding a qtwebengine_5.3.2+git.bbappend in your own layer, in which you add:

QT_MODULE_BRANCH = "5.4"

在那之后,您至少应该能够获取请求的 SHA1.这似乎是元数据中的错误.

After that, you should at least be able to fetch the requested SHA1. This seems to be bug in the meta data.

注意:我没有在 dizzy 分支上测试过这个.

这篇关于如何安装 &运行 QML QtWebEngine &SBC 上的 QtWebKit 使用 Yocto/无法从任何来源获取 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-08 17:17