Inconsistent building error "error: expected a ";" "

When building VTK on Rocky 9.5 and Intel compilers we get the following errors:

In file included from /home/myaux/ParaView-v5.11.1/VTK/ThirdParty/glew/vtkglew/src/glew.c(41):                                                                            
/usr/include/GL/osmesa.h(125): error: expected a ";"                                                    
  OSMesaCreateContext( GLenum format, OSMesaContext sharelist );                                        
  ^                                                                                                                                                                                                      
In file included from /home/myaux/ParaView-v5.11.1/VTK/ThirdParty/glew/vtkglew/src/glew.c(41):                                                                            
/usr/include/GL/osmesa.h(138): error: expected a ";"                                                    
  OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,                            
  ^                                                

Why is this happening?

Regards

Which version of VTK are you building ?

(post deleted by author)

– VTK version: 9.2.20220823

Please try with the last release of VTK, v9.4.2 or v9.5.0-rc1

Same problem with v9.4.2 …

I doubt it, as VTK 9.4.2 does not use glew at all.

Also the error you shared show ParaView, not VTK.

This is line 125 in osmesa.h where the error occurs:

GLAPI OSMesaContext GLAPIENTRY
OSMesaCreateContext( GLenum format, OSMesaContext sharelist );

So my guess is that either GLAPI or GLAPIENTRY are not defined. We can see that glew.c already defines GLAPI at line 40 before it includes osmesa.h:

#  define GLAPI extern
#  include <GL/osmesa.h>

The error might go away if you add an empty definition for GLAPIENTRY at this same place:

#  define GLAPIENTRY

But that’s just a guess. I don’t have either an intel compiler or a redhat-9 system to test with. Another possibility is that the gl.h on your system is providing incorrect definitions for GLAPI or GLAPIENTRY for the intel compiler.