Wayland Build - Glew Linking Failure on Arch Linux

Hello all, I’m attempting to build blender from source with wayland support on arch linux, but it seems to fail at the very end of the lengthy compilation process with the following error, which I assume is related to linking glew:

[100%] Linking CXX executable ../../bin/blender
../../lib/libbf_intern_ghost.a(GHOST_XrGraphicsBinding.cpp.o):GHOST_XrGraphicsBinding.cpp:function GHOST_XrGraphicsBindingOpenGL::initFromGhostContext(GHOST_Context&): error: undefined reference to '__glewXGetVisualFromFBConfig'
collect2: error: ld returned 1 exit status
make[2]: *** [source/creator/CMakeFiles/blender.dir/build.make:470: bin/blender] Error 1
make[1]: *** [CMakeFiles/Makefile2:7106: source/creator/CMakeFiles/blender.dir/all] Error 2
make: *** [Makefile:182: all] Error 2

The only other hunch I have is that this is related to arch linux and its separate glew and glew-wayland packages, which conflict with one another and do not seem to provide the same functionality. This bug report seems to detail more, and if you search “arch linux glew-wayland does not provide glew”, there are more reports with error messages similar to mine with different programs.
One weird thing with my build is that I had to fix a typo in OpenImageIO rawinput.cpp (longitude misspelled as longtitude in a method call), not sure if that’s relevant to my problem though.

Included CMakeCache.txt of the failed build.

Thanks for reading, hopefully I’ve just misunderstood something in the build process, as this is the first time I’ve compiled blender from source.

You could try enabling WITH_SYSTEM_GLEW.

By default Blender builds with its own version of GLEW, but perhaps that one is not compatible with the glew-wayland package.

Tried to build using WITH_SYSTEM_GLEW=ON, the first time having glew-wayland installed and after having glew installed. Due to the conflict between the packages on arch, I couldn’t try with both of them installed.

Error output given using glew-wayland.
Error output given using glew.

Is there anything else I can try or is a wayland build just not available for testing on my system?

Maybe using the system GLEW packages wasn’t a good suggestion, reading that bug report it seems that there are GLEW packages for either X11 or Wayland, while Blender can be compiled with support for both. And on top of that glew-wayland is missing EGL, which Blender needs.

Two possible solutions:

  • Turn WITH_SYSTEM_GLEW off again and also turn off WITH_XR_OPENXR, since that’s where the original link error is.
  • Turn off WITH_GHOST_X11 so that there is only Wayland support.

There may be something to be fixed in Blender here, but I’m not sure and will leave that up to @julianeisel or @christian.rauch. It’s suspicious that there is only one link error in the OpenXR code, seem that is somehow doing something different regarding GLX/GLEW.

There is a dedicated OpenXR extension for OpenGL on Wayland, we should probably use that, https://www.khronos.org/registry/OpenXR/specs/1.0/html/xrspec.html#XrGraphicsBindingOpenGLWaylandKHR.

I don’t have the time to look into this (it’s an easy task for beginners though), for now I suggest we disable WITH_XR_OPENXR on Wayland.