Search code examples
clinuxwaylandmeson-build

Wlroots, fatal error : xdg-shell-protocol.h: No such file or directory


Hi i was building a wayland compositor based on wlroots. When i was trying to add "wlr/types/wlr_xdg_shell.h" it produces an error showing :

/usr/local/include/wlr/types/wlr_xdg_shell.h:14:10: fatal error: xdg-shell-protocol.h: No such file or directory

is this a bug? i have tried modifying my meson.build file in protocols and projects folder. but nothing is changing.

here is the complete log:

ninja: Entering directory `build'
[1/2] Compiling C object 'src/25a6634@@compositor@exe/view.c.o'
FAILED: src/25a6634@@compositor@exe/view.c.o 
cc -Isrc/25a6634@@compositor@exe -Isrc -I../src -I../include -I/usr/local/include -I/usr/include/libdrm -I/usr/include/pixman-1 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -g -DLOG_USE_COLOR -Wno-unused-parameter -Wno-unused-result -Wno-missing-braces -Wundef -Wvla -DWLR_USE_UNSTABLE '-DPACKAGE_VERSION="1.0.0"' -MD -MQ 'src/25a6634@@compositor@exe/view.c.o' -MF 'src/25a6634@@compositor@exe/view.c.o.d' -o 'src/25a6634@@compositor@exe/view.c.o' -c ../src/view.c
In file included from ../include/view.h:2,
                 from ../src/view.c:1:
/usr/local/include/wlr/types/wlr_xdg_shell.h:14:10: fatal error: xdg-shell-protocol.h: No such file or directory
   14 | #include "xdg-shell-protocol.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.

Solution

  • The same problem happened to me once, please make sure that the wayland-protocols dependency name in your meson.build is same in the meson.build in the protocols folder

    Eg: if you have defined your dependency like this:

    meson.build in src directory (or your source directory)

    deps=[
         server_protocols, // use this name in meson.build in protocols
         wayland_server,
         wlroots
    ]
    

    Like this :

    meson.build file in protocols directory

    wl_protocol_dir=server_protos.get_pkgconfig_variable('pkgdatadir')
    

    This works for me