Compiling ParaView with VTK_USE_X and VTK_OPENGL_HAS_OSMESA simultaneously

I’m having some difficulties building with VTK_USE_X=ON and VTK_OPENGL_HAS_OSMESA=ON together as described at this link: ParaView Docs - Offscreen.

Utkarsh Ayachit (in this thread: osmesa linking problems) suggested that I might not have a suitable Mesa installation.

ParaView configuration attempts
When I tried to use both of those environment variables set to ON, I got a whole collection of OpenGL variables (each of which I set to my compiled copy of Mesa 20.1.3, with OSMesa and compiled using -Dglx=dri -Dplatforms='drm,x11' amongst other flags), but I was unable to find/use the OSMESA variables.

The GLU and xMesa variables I left with the system-detected libglu and unset, respectively. I also set VTK_OPENGL_HAS_EGL=OFF.

If I set them directly from the command line (rather than searching through and failing to find using ccmake) then I received warnings along the lines of ‘these variables were ignored’ (sorry, I forgot the exact wording) and then references to both OSMESA_INCLUDE_DIR and OSMESA_LIBRARY. These (the warnings) disappeared if I also passed -DENABLE_osmesa=ON but then I received a warning instead that that variable was ignored (it seems perhaps that is exclusively for the superbuild?).

When I set VTK_USE_X=OFF, the OSMESA_{INCLUDE_DIR,LIBRARY} variables appeared as expected and then compilation succeeded, and pvserver runs using MPI and forward/reverse connections as desired.

Mesa configuration
My Mesa compilation command was:

meson …/osmesa_build/ -Dprefix=/appsdir/mesa/20.1.3 -Dglx=dri -Ddri3=false -Dllvm=true -Dosmesa=gallium -Dvulkan-drivers=’’ -Dgallium-drivers=swr,swrast -Dgles1=false -Dgles2=false -Dopengl=true -Dgallium-vdpau=false -Dgallium-xvmc=false -Dgallium-va=false -Degl=true -Dshared-llvm=true -Dgbm=true -Ddri-drivers=’’ -Dplatforms=‘drm,x11’

This produced pkgconfig files named for dri.pc, egl.pc, gmb.pc, gl.pc and osmesa.pc, along with libraries libEGL.so, libGL.so, libOSMesa.so, libgbm.so, libglapi.so, libswrAVX.so and libswrAVX2.so.

There was no libGLX.so produced, although the output of readelf -s /appsdir/mesa/20.1.3/lib64/libGL.so.1.2.0 | grep 'glx' did list a number of functions with names like xcb_glx_... (e.g. xcb_glx_swap_buffers).

A separate attempt using the following configuration also didn’t produce a libGLX, although it did remove the libEGL:

meson …/osmesa_build2/ -Dprefix=/appsdir/mesa/20.1.3.glx -Dglx=gallium-xlib -Ddri3=false -Dllvm=true -Dosmesa=gallium -Dvulkan-drivers=’’ -Dgallium-drivers=swr,swrast -Dgles1=false -Dgles2=false -Dopengl=true -Dgallium-vdpau=false -Dgallium-xvmc=false -Dgallium-va=false -Degl=false -Dshared-llvm=true -Ddri-drivers=’’ -Dplatforms=‘x11’

Should I be instructing ParaView to do something with the libGL.so specifically, or perhaps symbolic linking a libGLX.so to the libGL?

Alternatively, is there some key change I should make to the Mesa configuration, or do I need to additionally build and install some part of the Xorg libraries?

1 Like

I misspoke. libGL is indeed what you want. libGL and libOSMesa.

The variables to set in ParaView config are:

  • OpenGL_GL_PREFERENCE (set to LEGACY)
  • OPENGL_INCLUDE_DIR
  • OPENGL_gl_LIBRARY
  • VTK_OPENGL_HAS_OSMESA (set to ON)
  • OSMESA_INCLUDE_DIR
  • OSMESA_LIBRARY

p.s. I have not tried this since Mesa version 18.*, but I’d suspect it still works with 20.*.

I think I am having the same problem. There is a library which should link against OSMesa.so, but it does not. I opened a bug report here:
https://gitlab.kitware.com/paraview/paraview/-/issues/20120