Building OpenCascade 7.5.0 with VTK 9.0.1

OCC 7.4 did not support vtk 9.x at all, but we made a bit of progress trying to build with 7.5.0 until here:

[ 90%] Building CXX object src/TKIVtkDraw/CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o
cd /builddir/build/BUILD/opencascade-7.5.0/x86_64-redhat-linux-gnu/src/TKIVtkDraw && /usr/bin/g++ -DHAVE_TBB -DHAVE_VTK -DOCC_CONVERT_SIGNALS -DTKIVtkDraw_EXPORTS -DVTK_OPENGL2_BACKEND -I/builddir/build/BUILD/opencascade-7.5.0/x86_64-redhat-linux-gnu/include/opencascade -isystem /usr/include/freetype2 -isystem /usr/include/vtk -std=c++0x -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fexceptions -fPIC -Wall -Wextra -O2 -g -DNDEBUG -fPIC -o CMakeFiles/TKIVtkDraw.dir/__/IVtkDraw/IVtkDraw.cxx.o -c /builddir/build/BUILD/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx
In file included from /builddir/build/BUILD/opencascade-7.5.0/src/InterfaceGraphic/InterfaceGraphic.hxx:39,
                 from /builddir/build/BUILD/opencascade-7.5.0/x86_64-redhat-linux-gnu/include/opencascade/InterfaceGraphic.hxx:1,
                 from /builddir/build/BUILD/opencascade-7.5.0/src/Aspect/Aspect_DisplayConnection.hxx:24,
                 from /builddir/build/BUILD/opencascade-7.5.0/x86_64-redhat-linux-gnu/include/opencascade/Aspect_DisplayConnection.hxx:1,
                 from /builddir/build/BUILD/opencascade-7.5.0/src/OpenGl/OpenGl_GraphicDriver.hxx:22,
                 from /builddir/build/BUILD/opencascade-7.5.0/x86_64-redhat-linux-gnu/include/opencascade/OpenGl_GraphicDriver.hxx:1,
                 from /builddir/build/BUILD/opencascade-7.5.0/src/IVtkDraw/IVtkDraw.cxx:34:
/usr/include/vtk/vtkDataArray.h:602:8: error: expected identifier before numeric constant
  602 | struct AllValues
      |        ^~~~~~~~~
/usr/include/vtk/vtkDataArray.h:602:8: error: expected unqualified-id before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:417:37: error: expected identifier before numeric constant
  417 | bool DoComputeVectorRange(A*, R[2], AllValues);
      |                                     ^~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:417:37: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:519:37: error: expected identifier before numeric constant
  519 | bool DoComputeVectorRange(A*, R[2], AllValues);
      |                                     ^~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:519:37: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:551:1: error: expected identifier before numeric constant
  551 | VTK_DECLARE_VALUERANGE_VALUETYPE(long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:551:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:551:1: error: expected identifier before numeric constant
  551 | VTK_DECLARE_VALUERANGE_VALUETYPE(long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:551:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:551:1: error: expected identifier before numeric constant
  551 | VTK_DECLARE_VALUERANGE_VALUETYPE(long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:551:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:551:1: error: expected identifier before numeric constant
  551 | VTK_DECLARE_VALUERANGE_VALUETYPE(long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:551:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:552:1: error: expected identifier before numeric constant
  552 | VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:552:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:552:1: error: expected identifier before numeric constant
  552 | VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:552:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:552:1: error: expected identifier before numeric constant
  552 | VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:552:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:552:1: error: expected identifier before numeric constant
  552 | VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:552:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:553:1: error: expected identifier before numeric constant
  553 | VTK_DECLARE_VALUERANGE_VALUETYPE(long long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:553:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:553:1: error: expected identifier before numeric constant
  553 | VTK_DECLARE_VALUERANGE_VALUETYPE(long long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:553:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:553:1: error: expected identifier before numeric constant
  553 | VTK_DECLARE_VALUERANGE_VALUETYPE(long long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:553:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:553:1: error: expected identifier before numeric constant
  553 | VTK_DECLARE_VALUERANGE_VALUETYPE(long long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:553:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:554:1: error: expected identifier before numeric constant
  554 | VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:554:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:554:1: error: expected identifier before numeric constant
  554 | VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:554:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:554:1: error: expected identifier before numeric constant
  554 | VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:554:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:554:1: error: expected identifier before numeric constant
  554 | VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:554:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:555:1: error: expected identifier before numeric constant
  555 | VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkDataArray, double)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:555:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.h:555:1: error: expected identifier before numeric constant
  555 | VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkDataArray, double)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.h:555:1: error: expected ',' or '...' before numeric constant
/usr/include/vtk/vtkGenericDataArray.txx: In member function 'bool vtkGenericDataArray<DerivedT, ValueTypeT>::ComputeScalarValueRange(vtkGenericDataArray<DerivedT, ValueTypeT>::ValueType*)':
/usr/include/vtk/vtkGenericDataArray.txx:1195:64: error: expected unqualified-id before numeric constant
 1195 |     static_cast<DerivedT*>(this), ranges, vtkDataArrayPrivate::AllValues{}, Supported{});
      |                                                                ^~~~~~~~~
/usr/include/vtk/vtkGenericDataArray.txx: In member function 'bool vtkGenericDataArray<DerivedT, ValueTypeT>::ComputeVectorValueRange(vtkGenericDataArray<DerivedT, ValueTypeT>::ValueType*)':
/usr/include/vtk/vtkGenericDataArray.txx:1205:63: error: expected unqualified-id before numeric constant
 1205 |     static_cast<DerivedT*>(this), range, vtkDataArrayPrivate::AllValues{}, Supported{});
      |                                                               ^~~~~~~~~

Fedora Rawhide x86_64
gcc 10.2.1

Any ideas?

Thanks,
Richard

It looks like there’s a #define AllValues ??? somewhere around. Does the preprocessed source look odd for the lines reported on here? (Add -E and change the output to be -o preproc.txt instead on the command line for the TU.)

Other than that, maybe @RobertMaynard has a better idea? @AllisonVacanti might have time to answer as well with luck.

Looks to be an issue where Xutil defines an AllValues macro.

https://gitlab.kitware.com/vtk/vtk/-/issues/18048

https://gitlab.kitware.com/vtk/vtk/-/issues/18048

Thanks for the link. Any idea on what the solution will be?

Thanks,
Richard

VTK will need to rename that structure.

Is it safe to use the workaround posted in the issue or should I wait? We’re currently trying to upgrade the whole stack and dependencies in Fedora (OCC, vtk).

Feel free to use vtkAllValues for now. I don’t imagine it is used very much outside of VTK right now.

Ok, not sure if it has to do with me renaming AllValues but after about 2.5 hours I ran into this:

/builddir/build/BUILD/VTK-9.0.1/Rendering/FreeType/vtkFreeTypeTools.cxx:382:1: error: expected constructor, destructor, or type conversion before 'vtkFreeTypeToolsFaceRequester'
  382 | vtkFreeTypeToolsFaceRequester(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/VTK-9.0.1/Rendering/FreeType/vtkFreeTypeTools.cxx: In member function 'virtual FT_Error vtkFreeTypeTools::CreateFTCManager()':
/builddir/build/BUILD/VTK-9.0.1/Rendering/FreeType/vtkFreeTypeTools.cxx:1154:61: error: 'vtkFreeTypeToolsFaceRequester' was not declared in this scope; did you mean 'vtkFreeTypeToolsCleanupCounter'?
 1154 |     this->MaximumNumberOfSizes, this->MaximumNumberOfBytes, vtkFreeTypeToolsFaceRequester,
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                             vtkFreeTypeToolsCleanupCounter

Hmm. Not sure exactly, but it looks like FT_CALLBACK_DEF(FT_Error) is expanding improperly. What version of FreeType is being used? It’s working here with freetype-devel-2.10.4-1.fc33.x86_64.

Same version, just the Rawhide f34 package…

Full log:

https://download.copr.fedorainfracloud.org/results/orion/vtk9.0/fedora-rawhide-x86_64/01772259-vtk/builder-live.log.gz

And just reproduced the problem here: https://open.cdash.org/viewBuildError.php?buildid=6890950

Investigating, it appears as though FT_CALLBACK_DEF has always been meant to be internal. This is true as of 2.10.4. https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7432

I applied the commit as a patch and got this far:

/builddir/build/BUILD/VTK-9.0.1/Rendering/FreeType/vtkFreeTypeTools.cxx
/builddir/build/BUILD/VTK-9.0.1/Rendering/FreeType/vtkFreeTypeTools.cxx:382:1: error: expected constructor, destructor, or type conversion before 'vtkFreeTypeToolsFaceRequester'
  382 | vtkFreeTypeToolsFaceRequester(
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/VTK-9.0.1/Rendering/FreeType/vtkFreeTypeTools.cxx: In member function 'virtual FT_Error vtkFreeTypeTools::CreateFTCManager()':
/builddir/build/BUILD/VTK-9.0.1/Rendering/FreeType/vtkFreeTypeTools.cxx:1154:61: error: 'vtkFreeTypeToolsFaceRequester' was not declared in this scope; did you mean 'vtkFreeTypeToolsCleanupCounter'?
 1154 |     this->MaximumNumberOfSizes, this->MaximumNumberOfBytes, vtkFreeTypeToolsFaceRequester,
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                             vtkFreeTypeToolsCleanupCounter

Hmm. I suspect something else went wrong there (still seems like it is missing a return type). Here is Fedora’s fix: https://src.fedoraproject.org/rpms/vtk/c/00964b32afb5e933ba39b9cf81f72dbf998b1ca7?branch=master

Seems freetype reverted the removal based on comments there. The change I made makes it not care anymore.

Oh :man_facepalming: , there are 2 uses of the macro in VTK…the other needs fixed too.

Fix for the other one is here: https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7434

So I should use your fix, correct? It looks like Sandro worked around it but Orion and I are working on the whole vtk/opencascade stack separately in a COPR:

I have a side tag I’m doing all the official builds in and once complete it will be merged back into the Rawhide repository.

I think the fixes I did is more useful long-term. Feel free to merge the two diffs into one patchfile though. Both MRs are on top of 9.0.0, so they should apply cleanly.

All seems good now… Only problem is how long it takes to build :slight_smile:

The build was automatically killed after 5 hours in the COPR. Took almost 2 1/2 hours on my workstation.

Thanks,
Richard