0

I am trying to learn how to make a Wayland compositor based on wlroots. Following their wiki, I am trying to compile tinywl.c (github) file as an example with

gcc -o wm1 wm1.c `pkg-config --libs --cflags pixman-1` -DWLR_USE_UNSTABLE

and I get the error

In file included from wm1.c:22: /usr/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..

I also checked the makefile but still do not completely understand how to compile this. So, I wonder what are the steps exactly. I am running an Arch Linux and Swaywm works just fine on my machine(I assume there are no missing libraries). Thank you for your help.

demortz
  • 51
  • 7
  • 1
    It appears that wlroots has a dependency on the [Wayland xdg-shell Protocol](https://wayland-book.com/xdg-shell-basics.html), and the development components for that are not installed on your machine. See also [this friendlier summary](https://wiki.tizen.org/Wayland_xdg-shell_protocol). – John Bollinger Aug 05 '20 at 14:28
  • I checked this before, xdg-shell-protocols are somehow included in [wayland-protocols](https://www.archlinux.org/packages/extra/any/wayland-protocols/) and I have it installed on my machine(Arch Linux). – demortz Aug 05 '20 at 14:38
  • 1
    Perhaps you have installed only the runtime components of wayland-protocols, not the development components. Or perhaps the install is broken, or for some reason the library headers are not installed in an appropriate location (which could be construed as a particular case of "broken"). If you indeed have the needed header, but the compiler does not find it, then you will need to add its directory to the include path via a compiler option of the general form `-I/path/to/header/directory'. – John Bollinger Aug 05 '20 at 14:44
  • Thanks. I ran the [Makefile](https://github.com/swaywm/wlroots/blob/master/tinywl/Makefile) to build tinywl and it produced the xdg-shell-protocol.h and xdg-shell-protocol.c . Also, I just learned from Makefile that I should probably use '-lwlroots -lwayland-server -lxkbcommon' when compiling. – demortz Aug 05 '20 at 15:01

0 Answers0