Compilation error of 7.5.0 with VTK-9

Hello, OpenCascade 7.5.0 builds fine against VTK-8, but I tried to switch to VTK-9 and it fails.

I already reported the problem to VTK: see Kitware's gitlab, issue 18240, but the problem seems hard to fix on their side: has anyone succeeded to build OpenCascade against VTK-9?

Thanks!

Kirill Gavrilov's picture

Could you please fix the URL to external Bugtracker in your message and put some information about the problem here?
As far as I know, it is technically possible building OCCT with VTK-9, so I'm curious what exactly happens in your scenario.

Thierry Thomas's picture

Hello,
I cannot post the exact URL, because it is rejected by the the forum.
Trying in two parts: gitlab.kitware.com/vtk/vtk/-/issues/18240 and add a scheme for secured http.
Thanks.

Kirill Gavrilov's picture
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:530:52: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType[2], vtkDataArrayPrivate::AllValues);                                     \
                                                   ^
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^

This is a common macros clash issue with system headers. New VTK introduced an unfortunate enumeration value "AllValues" defined also in Xutil.h as macros.

It is nice to avoid name clashes when they observed by renaming them in a library (as system X11 headers will certainly not do that - these name clashes with windows.h on Windows, X11 on Linux and even Cocoa on macOS happened more than decade ago and haven't been treated anyhow). But I guess VTK developers already decided not to do that.

In this case, the only options are to avoid including VTK and X11 headers in a single .cxx file, or to use macros #undef tricks.

Currently developed master branch of OCCT 7.6.0dev already contains the fix integrated with the following bug
(note that patch also fixes one other problem with VTK9 leading to crashes):
0032331: Visualization - Exception when trying to display some surfaces using iVtk with VTK 9

The patch for X11 name clash is trivial though:

--- a/src/IVtkDraw/IVtkDraw_Interactor.cxx
+++ b/src/IVtkDraw/IVtkDraw_Interactor.cxx
@@ -20,6 +20,13 @@
 #include <vtkWin32OpenGLRenderWindow.h>
 #else
 #include <GL/glx.h>
+
+// Preventing naming collisions between
+// GLX and VTK versions 9.0 and above
+#ifdef AllValues
+#undef AllValues
+#endif
+
 #include <vtkXRenderWindowInteractor.h>
 #include <vtkXOpenGLRenderWindow.h>
 #endif
Thierry Thomas's picture

Thanks! This is not sufficient to fix the problem, but I'll try to go continue with this. ATM the new failures are:

[ 99% 5649/5651] /usr/local/libexec/ccache/c++ -DHAVE_FFMPEG -DHAVE_FREEIMAGE -DHAVE_GLES2 -DHAVE_RAPIDJSON -DHAVE_VTK -DOCC_CONVERT_SIGNALS -DTKIVtkDraw_EXPORTS -DVTK_OPENGL2_BACKEND -I/usr/local/include/tcl8.6 -I/usr/local/include/tk8.6 -I/usr/local/include/freetype2 -Iusr/local/include/OpenCASCADE -isystem /usr/local/include/vtk-9.0 -std=c++0x -O2 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing -fexceptions -fPIC -Wall -Wextra -O2 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing -DNo_Exception -fPIC -pthread -MD -MT src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o -MF src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o.d -o src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o -c /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx
FAILED: src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o 
/usr/local/libexec/ccache/c++ -DHAVE_FFMPEG -DHAVE_FREEIMAGE -DHAVE_GLES2 -DHAVE_RAPIDJSON -DHAVE_VTK -DOCC_CONVERT_SIGNALS -DTKIVtkDraw_EXPORTS -DVTK_OPENGL2_BACKEND -I/usr/local/include/tcl8.6 -I/usr/local/include/tk8.6 -I/usr/local/include/freetype2 -Iusr/local/include/OpenCASCADE -isystem /usr/local/include/vtk-9.0 -std=c++0x -O2 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing -fexceptions -fPIC -Wall -Wextra -O2 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing -DNo_Exception -fPIC -pthread -MD -MT src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o -MF src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o.d -o src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o -c /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkVTK_ShapeData.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkVTK/IVtkVTK_ShapeData.hxx:23:
In file included from /usr/local/include/vtk-9.0/vtkPolyData.h:66:
In file included from /usr/local/include/vtk-9.0/vtkPointSet.h:57:
In file included from /usr/local/include/vtk-9.0/vtkPoints.h:29:
/usr/local/include/vtk-9.0/vtkDataArray.h:602:1: error: declaration of anonymous struct must be a definition
struct AllValues
^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkVTK_ShapeData.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkVTK/IVtkVTK_ShapeData.hxx:23:
In file included from /usr/local/include/vtk-9.0/vtkPolyData.h:68:
In file included from /usr/local/include/vtk-9.0/vtkCellArray.h:141:
In file included from /usr/local/include/vtk-9.0/vtkAOSDataArrayTemplate.h:36:
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:417:37: error: expected parameter declarator
bool DoComputeVectorRange(A*, R[2], AllValues);
                                    ^
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkVTK_ShapeData.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkVTK/IVtkVTK_ShapeData.hxx:23:
In file included from /usr/local/include/vtk-9.0/vtkPolyData.h:68:
In file included from /usr/local/include/vtk-9.0/vtkCellArray.h:141:
In file included from /usr/local/include/vtk-9.0/vtkAOSDataArrayTemplate.h:36:
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:417:37: error: expected ')'
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:417:26: note: to match this '('
bool DoComputeVectorRange(A*, R[2], AllValues);
                         ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkVTK_ShapeData.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkVTK/IVtkVTK_ShapeData.hxx:23:
In file included from /usr/local/include/vtk-9.0/vtkPolyData.h:68:
In file included from /usr/local/include/vtk-9.0/vtkCellArray.h:141:
In file included from /usr/local/include/vtk-9.0/vtkAOSDataArrayTemplate.h:36:
In file included from /usr/local/include/vtk-9.0/vtkGenericDataArray.h:422:
In file included from /usr/local/include/vtk-9.0/vtkGenericDataArray.txx:18:
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:519:37: error: expected parameter declarator
bool DoComputeVectorRange(A*, R[2], AllValues);
                                    ^
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkVTK_ShapeData.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkVTK/IVtkVTK_ShapeData.hxx:23:
In file included from /usr/local/include/vtk-9.0/vtkPolyData.h:68:
In file included from /usr/local/include/vtk-9.0/vtkCellArray.h:141:
In file included from /usr/local/include/vtk-9.0/vtkAOSDataArrayTemplate.h:36:
In file included from /usr/local/include/vtk-9.0/vtkGenericDataArray.h:422:
In file included from /usr/local/include/vtk-9.0/vtkGenericDataArray.txx:18:
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:519:37: error: expected ')'
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:519:26: note: to match this '('
bool DoComputeVectorRange(A*, R[2], AllValues);
                         ^
error: expected unqualified-id
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: expected parameter declarator
VTK_DECLARE_VALUERANGE_VALUETYPE(long)
^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:544:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType)                  \
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:526:29: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues);                                       \
                            ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: expected ')'
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:544:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType)                  \
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:526:50: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues);                                       \
                                                 ^
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: note: to match this '('
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:544:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType)                  \
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:525:65: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(                                  \
                                                                ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: explicit instantiation of 'DoComputeScalarRange' does not refer to a function template, variable template, member function, member class, or static data member
VTK_DECLARE_VALUERANGE_VALUETYPE(long)
^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:544:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType)                  \
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:525:45: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(                                  \
                                            ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:517:6: note: candidate template ignored: failed template argument deduction
bool DoComputeScalarRange(A*, R*, T);
     ^
error: expected unqualified-id
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: expected parameter declarator
VTK_DECLARE_VALUERANGE_VALUETYPE(long)
^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:544:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType)                  \
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:530:31: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType[2], vtkDataArrayPrivate::AllValues);                                     \
                              ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: expected ')'
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:544:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType)                  \
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:530:52: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType[2], vtkDataArrayPrivate::AllValues);                                     \
                                                   ^
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: note: to match this '('
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:544:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType)                  \
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:529:65: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
  extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(                                  \
                                                                ^
error: expected unqualified-id
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: expected parameter declarator
VTK_DECLARE_VALUERANGE_VALUETYPE(long)
^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:545:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:526:29: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues);                                       \
                            ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: expected ')'
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:545:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:526:50: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues);                                       \
                                                 ^
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: note: to match this '('
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:545:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:525:65: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(                                  \
                                                                ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: explicit instantiation of 'DoComputeScalarRange' does not refer to a function template, variable template, member function, member class, or static data member
VTK_DECLARE_VALUERANGE_VALUETYPE(long)
^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:545:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:525:45: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(                                  \
                                            ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:517:6: note: candidate template ignored: failed template argument deduction
bool DoComputeScalarRange(A*, R*, T);
     ^
error: expected unqualified-id
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: expected parameter declarator
VTK_DECLARE_VALUERANGE_VALUETYPE(long)
^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:545:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:530:31: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType[2], vtkDataArrayPrivate::AllValues);                                     \
                              ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: error: expected ')'
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:545:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:530:52: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
    ArrayType*, ValueType[2], vtkDataArrayPrivate::AllValues);                                     \
                                                   ^
/usr/local/include/X11/Xutil.h:73:20: note: expanded from macro 'AllValues'
#define AllValues       0x000F
                        ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:551:1: note: to match this '('
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:545:3: note: expanded from macro 'VTK_DECLARE_VALUERANGE_VALUETYPE'
  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
  ^
/usr/local/include/vtk-9.0/vtkGenericDataArray.h:529:65: note: expanded from macro 'VTK_DECLARE_VALUERANGE_ARRAYTYPE'
  extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(                                  \
                                                                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[ 99% 5649/5651] /usr/local/libexec/ccache/c++ -DHAVE_FFMPEG -DHAVE_FREEIMAGE -DHAVE_GLES2 -DHAVE_RAPIDJSON -DHAVE_VTK -DOCC_CONVERT_SIGNALS -DTKIVtkDraw_EXPORTS -DVTK_OPENGL2_BACKEND -I/usr/local/include/tcl8.6 -I/usr/local/include/tk8.6 -I/usr/local/include/freetype2 -Iusr/local/include/OpenCASCADE -isystem /usr/local/include/vtk-9.0 -std=c++0x -O2 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing -fexceptions -fPIC -Wall -Wextra -O2 -pipe -I/usr/local/include -fstack-protector-strong -fno-strict-aliasing -DNo_Exception -fPIC -pthread -MD -MT src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw_Interactor.cxx.o -MF src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw_Interactor.cxx.o.d -o src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw_Interactor.cxx.o -c /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:39:
In file included from usr/local/include/OpenCASCADE/IVtkTools_ShapePicker.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_ShapePicker.hxx:52:7: warning: 'Pick' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  int Pick (double theX, double theY, double theZ, vtkRenderer *theRenderer = NULL);
      ^
/usr/local/include/vtk-9.0/vtkAbstractPicker.h:102:15: note: overridden virtual function is here
  virtual int Pick(
              ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_HighlightAndSelectionPipeline.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.hxx:34:
In file included from usr/local/include/OpenCASCADE/IVtkTools_DisplayModeFilter.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_DisplayModeFilter.hxx:20:
In file included from usr/local/include/OpenCASCADE/IVtkTools_SubPolyDataFilter.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_SubPolyDataFilter.hxx:38:8: warning: 'PrintSelf' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  void PrintSelf (std::ostream& theOs, vtkIndent theIndent);
       ^
/usr/local/include/vtk-9.0/vtkPolyDataAlgorithm.h:46:8: note: overridden virtual function is here
  void PrintSelf(ostream& os, vtkIndent indent) override;
       ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_HighlightAndSelectionPipeline.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.hxx:34:
In file included from usr/local/include/OpenCASCADE/IVtkTools_DisplayModeFilter.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_DisplayModeFilter.hxx:20:
In file included from usr/local/include/OpenCASCADE/IVtkTools_SubPolyDataFilter.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_SubPolyDataFilter.hxx:63:15: warning: 'RequestData' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
              ^
/usr/local/include/vtk-9.0/vtkPolyDataAlgorithm.h:101:15: note: overridden virtual function is here
  virtual int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
              ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_HighlightAndSelectionPipeline.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.hxx:34:
In file included from usr/local/include/OpenCASCADE/IVtkTools_DisplayModeFilter.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_DisplayModeFilter.hxx:38:8: warning: 'PrintSelf' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  void PrintSelf (std::ostream& os, vtkIndent indent);
       ^
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_SubPolyDataFilter.hxx:38:8: note: overridden virtual function is here
  void PrintSelf (std::ostream& theOs, vtkIndent theIndent);
       ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_HighlightAndSelectionPipeline.hxx:1:
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.hxx:34:
In file included from usr/local/include/OpenCASCADE/IVtkTools_DisplayModeFilter.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_DisplayModeFilter.hxx:63:15: warning: 'RequestData' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *);
              ^
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_SubPolyDataFilter.hxx:63:15: note: overridden virtual function is here
  virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
              ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:53:16: warning: 'Initialize' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  virtual void Initialize();
               ^
/usr/local/include/vtk-9.0/vtkRenderWindowInteractor.h:91:16: note: overridden virtual function is here
  virtual void Initialize();
               ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:54:16: warning: 'Enable' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  virtual void Enable();
               ^
/usr/local/include/vtk-9.0/vtkRenderWindowInteractor.h:135:16: note: overridden virtual function is here
  virtual void Enable()
               ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:55:16: warning: 'Start' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  virtual void Start() { }
               ^
/usr/local/include/vtk-9.0/vtkRenderWindowInteractor.h:111:16: note: overridden virtual function is here
  virtual void Start();
               ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:40:
In file included from usr/local/include/OpenCASCADE/IVtkDraw_Interactor.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.hxx:101:8: warning: 'GetMousePosition' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  void GetMousePosition (Standard_Integer *theX, Standard_Integer *theY);
       ^
/usr/local/include/vtk-9.0/vtkRenderWindowInteractor.h:384:16: note: overridden virtual function is here
  virtual void GetMousePosition(int* x, int* y)
               ^
In file included from /wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkDraw/IVtkDraw_Interactor.cxx:46:
In file included from usr/local/include/OpenCASCADE/IVtkTools_ShapeDataSource.hxx:1:
/wrkdirs/usr/ports/cad/opencascade/work/opencascade-7.5.0/src/IVtkTools/IVtkTools_ShapeDataSource.hxx:83:15: warning: 'RequestData' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  virtual int RequestData(vtkInformation* theRequest,
              ^
/usr/local/include/vtk-9.0/vtkPolyDataAlgorithm.h:101:15: note: overridden virtual function is here
  virtual int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
              ^
10 warnings generated.
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /usr/ports/cad/opencascade
build of cad/opencascade | opencascade-7.5.0_2 ended at Sat Jun 26 17:13:11 CEST 2021

But anyway, I'm surprised that people can build OpenCascade against VTK-9 without patches!

Kirill Gavrilov's picture

I'm surprised that people can build OpenCascade against VTK-9 without patches!

I meant only that I was able to compile OCCT 7.5.0 with VTK-9 on Windows, I haven't tried this on other platforms.
Within the current state OCCT 7.6.0dev it should be compilable on Linux as well (as it should be now regularly checked on Jenkins since #0032331).

This is not sufficient to fix the problem,

OK, I see the problem. It seems that there are more patches in OCCT 7.6.0dev interfering with VTK9 problem (TKOpenGl headers have been clean up in scope of unrelated bug).
To workaround the issue on OCCT 7.5.x, you need to put the same fix as in previous message into IVtkDraw.cxx - somewhere between Aspect_DisplayConnection.hxx and IVtk_Types.hxx.

--- a/src/IVtkDraw/IVtkDraw.cxx
+++ b/src/IVtkDraw/IVtkDraw.cxx
 #include <Aspect_DisplayConnection.hxx>
+
+// Preventing naming collisions between
+// GLX and VTK versions 9.0 and above
+#ifdef AllValues
+#undef AllValues
+#endif
+
 #include <IVtk_Types.hxx>
Thierry Thomas's picture

Yes! this does the trick: these two patches (plus the one for VTK-9) are sufficient!
Thanks (this ticket can be closed).