Solved 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!
-
Hi,
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
QtWayland.Compositor
module? -
When you say binary, do you mean from the online/offline installer ?
-
Yes I download
qt-opensource-linux-x64-5.9.2.run
offline 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
Thanks!
-
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/qtwayland
which 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?
-
@SGaist is it good to clone from https://code.qt.io/cgit/qt/qtwayland.git/ and build it? The path does not look like what you suggested but I think it is the same module. yes?
-
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[2]: *** [.obj/qwaylandintegration.o] Error 1 make[2]: Leaving directory '/home/aras/Projects/qtwayland/src/client' Makefile:73: recipe for target 'sub-client-make_first' failed make[1]: *** [sub-client-make_first] Error 2 make[1]: 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.
-
@SGaist said in How do I install QtCompositor module?:
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. :)