How to Build Qtwayland

How to build qtwayland?

Most of the content on the wiki page was written many years ago. I made an effort to clean up things I know are not relevant anymore and hope to get the wiki page in a usable state.

The problem as I see it, is that there are so many ways to build Qt, and how to build QtWayland depends on that.

The two most common options:

Building QtWayland as part of a full (or toplevel Qt build)

When configuring Qt, you can add -feature-wayland-server to you configure line. And it will make sure the wayland compositor API is part of your Qt build. Configure will then fail if the dependencies of QtWayland is not met. I.e. if you need dev packages for Wayland.

Then you can either just run make which will build all of Qt as you configured it, or run make module-qtwayland which should only build QtWayland and the required dependencies (qtbase, qtdeclarative, qtxmlpatterns).

Building QtWayland against an existing Qt installation (without QtWayland)

First you need to find qmake for your desired Qt version. If it's the one provided by the system, it's usually on your PATH already. If you are going to use Qt provided by the Qt installer, it's usually in ~/Qt/5.10.0/gcc_64/bin/qmake or equivalent for your version and architecture.

Clone qtwayland

git clone git://code.qt.io/qt/qtwayland.git
cd qtwayland
git checkout v5.10.0 #or whatever version your qmake reports

Configure with qmake

qmake

or

~/Qt/5.10.0/gcc_64/bin/qmake

You should now see:

Qt Wayland Client ........................ yes
Qt Wayland Compositor .................... yes

In your terminal, or else you are probably missing some dependencies.

Build with make

make
make install

Build examples

Depending on your configuration, this may need to be run explicitly:

make sub-examples

Failed when build qtwayland in Yocto

I try to add wayland feature to the DISTRO feature in local.conf

DISTRO_FEATURES_NATIVESDK_append = " wayland"
DISTRO_FEATURES_append = " wayland"

The Yocto build is successful now. Cheers!

Running Qt application under wayland

Why does configuring QtWayland fail?

I'm assuming (correct me if I'm wrong) that you are trying to build QtWayland against official Qt binaries that do not include QtWayland.

Do you have development packages installed? In your case I think it should be wayland-devel.

Btw, the libwayland-egl.so you see, is your distro's version of the qt wayland-egl buffer integration (and not the same as the libwayland-egl.so dependency which qmake complains is missing). However, you should still be able to build QtWayland without wayland-egl, so I'm not sure what this is about.

Other options:

1. Use official QtWayland binaries

You are probably running into this problem because Qt packages did not previously include QtWayland.

However, starting with Qt 5.11.0 the official Qt binaries should include QtWayland, so the easiest thing would probably be to install Qt 5.11.0 or newer.

2. Use the distro's version of Qt (and Qt Wayland)

Install and use Qt from the distro, make sure you also install qtwayland (on Fedora I think it's qt5-qtwayland).

How to develop apps for Wayland without using a widget toolkit?

Using libwayland-client.

The following are some materials for reference:

https://github.com/emersion/hello-wayland

https://wayland-book.com/

https://www.youtube.com/watch?v=KbryyNrMYl4



Related Topics



Leave a reply



Submit