I see you use -DMESA_EGL_NO_X11_HEADERS, I believe that means you are going to compile with at least EGL. If so, you have to add a dependency towards Mesa (and more specifically EGL if that is possible), either your package or the regular one.