运行 wayland下的Qt应用

Running Qt application under wayland

运行:

./myapp -platform wayland

给出:

This application failed to start because it could not find or load the Qt platform plugin "wayland" in "".

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Reinstalling the application may fix this problem. Aborted (core dumped)

按照说明操作:

运行 qmake 给出:

Running configuration tests... Done running configuration tests.

Configure summary: Qt Wayland Client ........................ no

Qt Wayland Compositor .................... no

Note: No wayland-egl support detected. Cross-toolkit compatibility disabled.

qtwayland README 指示 2 个依赖项:

  1. xkbcommon 0.2.0 - http://xkbcommon.org/
  2. 韦兰 1.6.0 - http://wayland.freedesktop.org/

在fedora 28上,默认安装了libxkbcommon。另外我还安装了libxkbcommon-devel

 dnf whatprovides *wayland*

returns 没有结果,尽管我的 gnome 会话 运行ning 在 wayland 下。

我知道我可以从 https://wayland.freedesktop.org/releases.html 下载 wayland。 我下载并解压了 1.15,但不确定如何处理解压后的源代码:我要构建它吗?我需要把它放在 qtwayland 可以找到的地方吗?

我看到fedora 28默认存在以下文件:

/usr/lib64/qt5/plugins/wayland-graphics-integration-server/libwayland-egl.所以

但复制到~/Qt/5.10.1/gcc_64/plugins/platforms 无法解决我的应用程序启动错误。

问题:如何让我的 Qt 应用程序在 wayland 下达到 运行?


为回答以下 bobbaluba 问题而添加:

我正在尝试针对官方 Qt 二进制文件构建 QtWayland,因为它不包含在内。

按照建议安装了 wayland-devel,但是 qmake 仍然报告没有配置 Qt Wayland 客户端,正如上面的消息。

尝试使用 dnf 安装 qt5-qtwayland,报告: 包 qt5-qtwayland-5.10.1-2.fc28.x86_64 已经安装,跳过。

以下可能是相关的:

? sudo dnf whatprovides libwayland-egl.so

Last metadata expiration check: 0:18:44 ago on Wed 09 May 2018 09:15:20 PM +08.

qt5-qtwayland-5.10.1-2.fc28.i686 : Qt5 - Wayland platform support and QtCompositor module

Repo : fedora

Matched from:

Provide : libwayland-egl.so

?查找/-name libwayland-egl.so* -print

/usr/lib64/libwayland-egl.so

/usr/lib64/qt5/plugins/wayland-graphics-integration-server/libwayland-egl.so

?须藤 ldconfig -p | grep wayland-egl

libwayland-egl.so.1 (libc6,x86-64) => /lib64/libwayland-egl.so.1

libwayland-egl.so (libc6,x86-64) => /lib64/libwayland-egl.so

安装了 Qt 5.11.0rc,导致

~/Qt/5.11.0/gcc_64/plugins/wayland-graphics-integration-server/libwayland-egl.so

~/Qt/5.11.0/gcc_64/plugins/wayland-graphics-integration-server/libwayland-egl.so.debug

正在添加到 ~/Qt/5.11.0/gcc_64/plugins/platforms.

cmake 的 CMakeFile.txt 在我安装 Qt5.11rc 时突然停止工作 - gcc 无法找到像 QDate 这样的 Qt 头文件。

尝试使用 Qt5.11 编译示例项目 'addressbook' 并得到:

QSocketNotifier: Can only be used with threads started with QThread

Using Wayland-EGL

Using the 'xdg-shell-v6' shell integration

简而言之,使用 Qt5.11rc 似乎可以解决问题。

为什么配置 QtWayland 失败?

我假设(如果我错了请纠正我)您正在尝试针对不包含 QtWayland 的官方 Qt 二进制文件构建 QtWayland。

你有安装开发包吗?在你的情况下,我认为它应该是 wayland-devel.

顺便说一句,您看到的 libwayland-egl.so 是您发行版的 qt wayland-egl 缓冲区集成版本(与 qmake 抱怨缺少的 libwayland-egl.so 依赖项不同)。但是,您应该仍然能够在没有 wayland-egl 的情况下构建 QtWayland,所以我不确定这是关于什么的。

其他选项:

1。使用官方 QtWayland 二进制文件

您可能 运行 遇到了这个问题,因为 Qt 包之前不包含 QtWayland。

但是,从 Qt 5.11.0 开始,官方 Qt 二进制文件应该包括 QtWayland,因此最简单的方法可能是安装 Qt 5.11.0 或更新版本。

2。使用发行版的 Qt(和 Qt Wayland)

从发行版安装和使用 Qt,确保你也安装了 qtwayland(在 Fedora 上我认为它是 qt5-qtwayland)。