OSMesa linking problems compiling ParaView on openSUSE Leap 15.1

Hello together,

I am trying to compile ParaView 5.8.0 on OpenSUSE Leap 15.1.
The last ParaView version compiled was 5.6.0 and it compiled ok.
with 5.8.0 I am getting the following errors, while linking:

Scanning dependencies of target ChartsCore
[ 79%] Linking CXX executable …/…/…/bin/vtkProbeOpenGLVersion-pv5.8
[ 79%] Building CXX object VTK/Interaction/Widgets/CMakeFiles/InteractionWidgets.dir/vtkPointPlacer.cxx.o
[ 79%] Building CXX object VTK/Charts/Core/CMakeFiles/ChartsCore.dir/vtkAxis.cxx.o
/usr/lib64/gcc/x86_64-suse-linux/7/…/…/…/…/x86_64-suse-linux/bin/ld: …/…/…/lib64/libvtkRenderingOpenGL2-pv5.8.so.5.8: undefined reference to OSMesaDestroyContext' /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: ../../../lib64/libvtkRenderingOpenGL2-pv5.8.so.5.8: undefined reference to OSMesaMakeCurrent’
/usr/lib64/gcc/x86_64-suse-linux/7/…/…/…/…/x86_64-suse-linux/bin/ld: …/…/…/lib64/libvtkRenderingOpenGL2-pv5.8.so.5.8: undefined reference to OSMesaGetCurrentContext' /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: ../../../lib64/libvtkRenderingOpenGL2-pv5.8.so.5.8: undefined reference to OSMesaCreateContext’
/usr/lib64/gcc/x86_64-suse-linux/7/…/…/…/…/x86_64-suse-linux/bin/ld: …/…/…/lib64/libvtkRenderingOpenGL2-pv5.8.so.5.8: undefined reference to `OSMesaGetProcAddress’
collect2: error: ld returned 1 exit status
make[2]: *** [VTK/Rendering/OpenGL2/CMakeFiles/vtkProbeOpenGLVersion.dir/build.make:112: bin/vtkProbeOpenGLVersion-pv5.8] Error 1
make[1]: *** [CMakeFiles/Makefile2:12375: VTK/Rendering/OpenGL2/CMakeFiles/vtkProbeOpenGLVersion.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs…

The OSMesa library is installed:

> zypper se libOSMesa
Loading repository data...
Reading installed packages...

S  | Name                  | Summary                                                      | Type   
---+-----------------------+--------------------------------------------------------------+--------
i+ | libOSMesa-devel       | Development files for the Mesa Offscreen Rendering extension | package
   | libOSMesa-devel-32bit | Development files for the Mesa Offscreen Rendering extension | package
i+ | libOSMesa8            | Mesa Off-screen rendering extension                          | package
i+ | libOSMesa8-32bit      | Mesa Off-screen rendering extension                          | package

I have not found anything about such an error online or on this forum. I am at a loss what the reason for the error, how should I proceed?

Take care,

George

Note that OSMesa and X support are mutually exclusive. The old build system probably just silently disabled one of them. rc3 will have a condition letting you know that you’ve requested an impossible configuration.

Basically, if you want OSMesa support, X support has to be disabled.

Dear Ben

how do I do that? I am setting

VTK_OPENGL_HAS_OSMESA=ON 
OSMESA_INCLUDE_DIR=/usr/include/GL
OSMESA_LIBRARY=/usr/lib64/libOSMesa.so

in the CMAKE configuration and the files referenced are there:

> dir /usr/lib64/libOSMesa.so*
lrwxrwxrwx 1 root root      18 Jan 16 10:09 /usr/lib64/libOSMesa.so -> libOSMesa.so.8.0.0
lrwxrwxrwx 1 root root      18 Jan 16 10:09 /usr/lib64/libOSMesa.so.8 -> libOSMesa.so.8.0.0
-rwxr-xr-x 1 root root 4864008 Jan 16 10:09 /usr/lib64/libOSMesa.so.8.0.0
> dir /usr/include/GL
total 3012
-rw-r--r-- 1 root root   10411 Oct 17  2014 freeglut_ext.h
-rw-r--r-- 1 root root     681 Oct 21  2003 freeglut.h
-rw-r--r-- 1 root root   27097 Oct 17  2014 freeglut_std.h
-rw-r--r-- 1 root root  410096 Jan 16 10:09 glcorearb.h
-rw-r--r-- 1 root root 1186601 Dec 17  2018 glew.h
-rw-r--r-- 1 root root  832367 Jan 16 10:09 glext.h
-rw-r--r-- 1 root root   80631 Jan 16 10:09 gl.h
-rw-r--r-- 1 root root  158833 Jan 16 10:09 gl_mangle.h
-rw-r--r-- 1 root root   17255 Dec 17  2018 glu.h
-rw-r--r-- 1 root root    3315 Dec 17  2018 glu_mangle.h
-rw-r--r-- 1 root root     639 Oct 21  2003 glut.h
-rw-r--r-- 1 root root   73435 Dec 17  2018 glxew.h
-rw-r--r-- 1 root root   48082 Jan 16 10:09 glxext.h
-rw-r--r-- 1 root root   14642 Jan 16 10:09 glx.h
-rw-r--r-- 1 root root    4706 Jun  7  2018 glxint.h
-rw-r--r-- 1 root root    3471 Jan 16 10:09 glx_mangle.h
-rw-r--r-- 1 root root    2086 Jun  7  2018 glxmd.h
-rw-r--r-- 1 root root   80979 Jun  7  2018 glxproto.h
-rw-r--r-- 1 root root   11436 Jun  7  2018 glxtokens.h
drwxr-xr-x 2 root root    4096 Jan 25 08:50 internal
-rw-r--r-- 1 root root   10360 Jan 16 10:09 osmesa.h
-rw-r--r-- 1 root root   63314 Dec 17  2018 wglew.h

Best regards,

George

VTK_USE_X is ON by default on Linux, so you’ll need to disable it explicitly.

Dear Ben,

that did the trick. It compiled without a glitch.

Take care,

George

Dear Ben,

I had the same issue today (or at least, a very similar looking one).

I’m hopeful that my current compilation (with -DVTK_USE_X=OFF) will complete, but I was seemingly mislead by documentation here: https://kitware.github.io/paraview-docs/v5.8.0/cxx/Offscreen.html

That page explicitly claims that it’s now possible to use X and OSMESA flags at the same time in the build - do you know if this is a) just not true, b) I’ve misunderstood the entire thing, or c) true only for some versions more recent than 5.8.0 (i.e. dev)? (Perhaps I should include the implicit d) Some other option I can’t think of…)

If I want both, is there a recommended way to do this? (i.e. via two separate compilations, what are the best collection of flags relevant to either case to provide an X tunnelling compatible setup and a headless server that I connect to via a desktop client?)

That is indeed correct. However, not the following mentioned on the page you linked:

If VTK_OPENGL_HAS_OSMESA is ON, and VTK_USE_X is ON, then all the OpenGL
and OSMesa variables should point to the Mesa libraries.

This, AFAIK, is not possible using standard platform provided OSMesa since the that package typically does not provide GLX. If you custom build mesa with OSMesa and GLX support, then it should work.

Dear Utkarsh,

Thank you for the clarification.
I’m going to open a new question because I think I’m moving away from the original topic here - it seems likely my problem may be related to the GLX support you mention (although I’m using a custom built installation of Mesa v20.1.3, and I thought GLX support).