Search code examples
linuxqtqmakeqtwayland

How to build qtwayland?


I spent whole day trying to use QtWayland.Compositor 1.0 in Qt creator. I have followed all the steps from there https://wiki.qt.io/QtWayland but I get the following error. I don't know what does it mean, that is my first contact with linux. I have the newest linux mint on a vm.

$ sudo make install
cd src/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/emil/wayland/qtwayland/src/src.pro -o Makefile ) && make -f Makefile install
make[1]: Entering directory '/home/emil/wayland/qtwayland/src'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/emil/wayland/qtwayland/src'
cd examples/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/emil/wayland/qtwayland/examples/examples.pro -o Makefile ) && make -f Makefile install
make[1]: Entering directory '/home/emil/wayland/qtwayland/examples'
cd wayland/ && ( test -e Makefile || /usr/lib/x86_64-linux-gnu/qt5/bin/qmake /home/emil/wayland/qtwayland/examples/wayland/wayland.pro -o Makefile ) && make -f Makefile install
make[2]: Entering directory '/home/emil/wayland/qtwayland/examples/wayland'
Some of the required modules (qtHaveModule(waylandcompositor) qtConfig(opengl)) are not available.
Skipped.
make[2]: Leaving directory '/home/emil/wayland/qtwayland/examples/wayland'
make[1]: Leaving directory '/home/emil/wayland/qtwayland/examples'

how can I fix that? All I want to do is to run the examples from the Qt installation :c.


Solution

  • 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