Created attachment 108415 [details] simple patch KWin 5.11.1 fails to build against the system gbm on Kubuntu 14.04.5 LTS (for use with a personal Neon5-like environment). It's a trivial error: size_t is undefined (= gbm.h apparently expects sys/types.h to be included). Including the headerfile fixes the build.
I think the better solution is to increase the minimum version of gbm. Adding includes to fix library bugs is always problematic as that bitrots pretty quickly.
How is that a library bug? You may not agree with the design principle, but it's nothing new that not all headers are always self-sufficient. There's no bug in the sense that testGbmSurface completes without error. That said, I see that I only had the 10.1.3 dev package installed, the library is at 11.2.0 . The gbm.h from that newer version includes stddef.h, that should also prevent the issue.
You just confirmed yourself that it is a library bug: the newer version includes the required header.
Whatever floats your boat. Guess I know what to do next time I run into a header that's clearly not self-sufficient.