diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -77,10 +77,11 @@
 #if defined(MOZ_WIDGET_GTK)
 #  include "mozilla/widget/GtkCompositorWidget.h"
 #  if defined(MOZ_WAYLAND)
 #    include <gdk/gdkwayland.h>
 #    include <wayland-egl.h>
+#    include "mozilla/WidgetUtilsGtk.h"
 #    include "mozilla/widget/nsWaylandDisplay.h"
 #  endif
 #endif
 
 struct wl_egl_window;
diff --git a/gfx/gl/GLContextProviderLinux.cpp b/gfx/gl/GLContextProviderLinux.cpp
--- a/gfx/gl/GLContextProviderLinux.cpp
+++ b/gfx/gl/GLContextProviderLinux.cpp
@@ -11,49 +11,59 @@
 namespace mozilla::gl {
 
 using namespace mozilla::gfx;
 using namespace mozilla::widget;
 
+#ifdef MOZ_X11
 static class GLContextProviderGLX sGLContextProviderGLX;
+#endif
 static class GLContextProviderEGL sGLContextProviderEGL;
 
 already_AddRefed<GLContext> GLContextProviderLinux::CreateForCompositorWidget(
     CompositorWidget* aCompositorWidget, bool aHardwareWebRender,
     bool aForceAccelerated) {
   if (gfxVars::UseEGL()) {
     return sGLContextProviderEGL.CreateForCompositorWidget(
         aCompositorWidget, aHardwareWebRender, aForceAccelerated);
+#ifdef MOZ_X11
   } else {
     return sGLContextProviderGLX.CreateForCompositorWidget(
         aCompositorWidget, aHardwareWebRender, aForceAccelerated);
+#endif
   }
 }
 
 /*static*/
 already_AddRefed<GLContext> GLContextProviderLinux::CreateHeadless(
     const GLContextCreateDesc& desc, nsACString* const out_failureId) {
   if (gfxVars::UseEGL()) {
     return sGLContextProviderEGL.CreateHeadless(desc, out_failureId);
+#ifdef MOZ_X11
   } else {
     return sGLContextProviderGLX.CreateHeadless(desc, out_failureId);
+#endif
   }
 }
 
 /*static*/
 GLContext* GLContextProviderLinux::GetGlobalContext() {
   if (gfxVars::UseEGL()) {
     return sGLContextProviderEGL.GetGlobalContext();
+#ifdef MOZ_X11
   } else {
     return sGLContextProviderGLX.GetGlobalContext();
+#endif
   }
 }
 
 /*static*/
 void GLContextProviderLinux::Shutdown() {
   if (gfxVars::UseEGL()) {
     sGLContextProviderEGL.Shutdown();
+#ifdef MOZ_X11
   } else {
     sGLContextProviderGLX.Shutdown();
+#endif
   }
 }
 
 }  // namespace mozilla::gl
diff --git a/gfx/gl/moz.build b/gfx/gl/moz.build
--- a/gfx/gl/moz.build
+++ b/gfx/gl/moz.build
@@ -105,14 +105,15 @@
 
 elif gl_provider == "Linux":
     # GLContextProviderGLX.cpp needs to be kept out of UNIFIED_SOURCES
     # as it includes X11 headers which cause conflicts.
     SOURCES += [
-        "GLContextProviderGLX.cpp",
         "GLContextProviderLinux.cpp",
     ]
     EXPORTS += ["GLContextGLX.h", "GLXLibrary.h"]
+    if CONFIG["MOZ_X11"]:
+        SOURCES += ["GLContextProviderGLX.cpp"]
 
 if CONFIG["MOZ_WAYLAND"]:
     SOURCES += ["SharedSurfaceDMABUF.cpp"]
 
 UNIFIED_SOURCES += [
diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -991,11 +991,11 @@
   }
 
   RefPtr<VsyncSource> softwareVsync = new XrandrSoftwareVsyncSource();
   return softwareVsync.forget();
 #else
-  return CreateSoftwareVsyncSource();
+  return GetSoftwareVsyncSource();
 #endif
 }
 
 void gfxPlatformGtk::BuildContentDeviceData(ContentDeviceData* aOut) {
   gfxPlatform::BuildContentDeviceData(aOut);

