How do I install QtCompositor module?
I want to give wayland a try and reading through some online documentation I understand I need to install QtCompositor module which does not automatically get installed with installation of Qt.
I found this documentation but it seems out dated.
I am using Ubuntu Linux 17.20 and Qt5.9.2. Can anyone point me to up to date instructions on how to install QTCompositor or detail instructions on how to get started with QtWayland? I am assuming that is what I should use to access wayland API from Qt. Any help is much appreciated!
QtWayland is now part of the Qt distribution, you can start from here.
@SGaist thank you for the reply but although I have a recent installation of Qt distribution (5.9.2 binary) I still get the following error:
QQmlApplicationEngine failed to load component qrc:///main.qml:4 module "QtWayland.Compositor" is not installed
Thanks for the link. I tried running the minimal example mentioned on that link, but I still get the above error.
Any ideas why, or how I could install
When you say binary, do you mean from the online/offline installer ?
Yes I download
qt-opensource-linux-x64-5.9.2.runoffline installer a few weeks ago and installed it.
More info about my system just in case:
Linux 4.13.0-17-generic #20-Ubuntu SMP Mon Nov 6 10:04:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux ~$ qmake -v QMake version 3.1 Using Qt version 5.9.2 in /home/aras/Qt5.9.2/5.9.2/gcc_64/lib
Looks like there is an open bug for this issue: https://bugreports.qt.io/browse/QTBUG-63011
I also found another thread on this forum that does not have an answer:.
If it is a bug I'd love to know if there is a workaround. There must be a way right?
Well, I think that QTBUG-60601 is even more relevant to your case. Short version: build the module from source.
Download the source from the installer and then the classic
/path/to/Qt/5.9.X/gcc_64/bin/qmake && make && make install
@SGaist do you mean I should build qt itself from source? Are you sure? It does look like QtWayland is installed along with Qt. I have a folder called
~/Qt5.9.2/5.9.2/Src/qtwaylandwhich I think is the wayland module. Is it possible it is installed but just not available for some reason?
I also found this other open bug that suggest wayland module needs a qmldir file. Do you know what file it is talking about? What should I put in that file and were do I place it to fix it.
I kind of like developing against the binary version of Qt. It is a lot of work to build it from source (sorry I know I am lazy). Thanks!
That bug is for a static compilation which is not what you are going to do.
Build only the QtWayland module, not the whole of Qt.
@SGaist ok I'll give it a go. Can you specify where I should download the source for this module from?
Well that wayland module cloned from the link I posted does not build on my system. It gave this error:
In file included from ../../include/QtWaylandClient/5.10.0/QtWaylandClient/private/qwaylandwindow_p.h:1:0, from qwaylandshmwindow_p.h:54, from qwaylandintegration.cpp:43: ../../include/QtWaylandClient/5.10.0/QtWaylandClient/private/../../../../../src/client/qwaylandwindow_p.h:150:10: error: ‘void QtWaylandClient::QWaylandWindow::setWindowState(Qt::WindowStates)’ marked ‘override’, but does not override void setWindowState(Qt::WindowStates state) override; ^~~~~~~~~~~~~~ qwaylandintegration.cpp: In constructor ‘QtWaylandClient::QWaylandIntegration::QWaylandIntegration()’: qwaylandintegration.cpp:141:49: error: invalid new-expression of abstract class type ‘QtWaylandClient::QWaylandDrag’ mDrag.reset(new QWaylandDrag(mDisplay.data())); ^ In file included from qwaylandintegration.cpp:51:0: qwaylanddnd_p.h:68:31: note: because the following virtual functions are pure within ‘QtWaylandClient::QWaylandDrag’: class Q_WAYLAND_CLIENT_EXPORT QWaylandDrag : public QBasicDrag ^~~~~~~~~~~~ In file included from qwaylanddnd_p.h:54:0, from qwaylandintegration.cpp:51: /home/aras/Qt5.9.2/5.9.2/gcc_64/include/QtGui/5.9.2/QtGui/qpa/qplatformdrag.h:98:24: note: virtual QMimeData* QPlatformDrag::platformDropData() virtual QMimeData *platformDropData() = 0; ^~~~~~~~~~~~~~~~ Makefile:2911: recipe for target '.obj/qwaylandintegration.o' failed make: *** [.obj/qwaylandintegration.o] Error 1 make: Leaving directory '/home/aras/Projects/qtwayland/src/client' Makefile:73: recipe for target 'sub-client-make_first' failed make: *** [sub-client-make_first] Error 2 make: Leaving directory '/home/aras/Projects/qtwayland/src' Makefile:46: recipe for target 'sub-src-make_first' failed make: *** [sub-src-make_first] Error 2 aras@aras-GL752VW:~/Projects/qtwayland$ git status On branch 5.10 Your branch is up-to-date with 'origin/5.10'.
You should rather build the module that you have in the Src folder or at least checkout the matching branch from your clone.
or at least checkout the matching branch from your clone.
Duh! Yes that was it. I just checked out 5.9.3 and build and installed. That worked like a charm. Thank you!
for the record, this is what I did:
git clone git://code.qt.io/qt/qtwayland.git cd qtwayland Projects/qtwayland$ git checkout origin/5.9.3 qmake make make install
And this time there was no error and I successfully ran, for the first time, a simple Wayland sample application. :)