FreeCAD 0.18.4 fails to build with vtk 9.0
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- kkremitzki
- Veteran
- Posts: 2517
- Joined: Thu Mar 03, 2016 9:52 pm
- Location: Illinois
Re: FreeCAD 0.18.4 fails to build with vtk 9.0
The state of VTK in Debian is actually a bit of a problem... something I was thinking I might have to jump into myself. Not surprised to see it not build, though.
- hobbes1069
- Posts: 291
- Joined: Wed Nov 09, 2011 3:49 pm
- Location: Southaven, MS
Re: FreeCAD 0.18.4 fails to build with vtk 9.0
I asked the Fedora maintainer of VTK if there's some kind of porting guide due to the significance of the changes. Hopefully there's something.
Re: FreeCAD 0.18.4 fails to build with vtk 9.0
hobbes1069 wrote: ↑Fri May 29, 2020 1:20 am So now I'm back in install hell... But at least it builds!
What changed?hobbes1069 wrote: ↑Tue Jun 09, 2020 6:30 pm I'm not having much luck building master, so before I keep hitting my head against the wall, do we even know if it's compatible with VTK 9.0?
I think VTK 9 is going to be tough. I don't see any activity yet upstream https://git.salome-platform.org/gitweb/ ... ;a=summary
Nor this fork https://github.com/LaughlinResearch/SMESH/issues which disables MED BTW.
For the Conda based builds we already use this fork already.
And of course FreeCAD's internal version.
"fight the good fight"
- hobbes1069
- Posts: 291
- Joined: Wed Nov 09, 2011 3:49 pm
- Location: Southaven, MS
- hobbes1069
- Posts: 291
- Joined: Wed Nov 09, 2011 3:49 pm
- Location: Southaven, MS
Re: FreeCAD 0.18.4 fails to build with vtk 9.0
So basically all the function names changed?
https://vtk.org/Wiki/VTK/API_Changes_8_2_0_to_9_0_0
They also moved from the old CMake module find method to using targets:
https://vtk.org/doc/nightly/html/md__ho ... c815a.html
https://lorensen.github.io/VTKExamples/site/
https://vtk.org/Wiki/VTK/API_Changes_8_2_0_to_9_0_0
They also moved from the old CMake module find method to using targets:
https://vtk.org/doc/nightly/html/md__ho ... c815a.html
https://lorensen.github.io/VTKExamples/site/
Re: FreeCAD 0.18.4 fails to build with vtk 9.0
I have merged right now a PR I was working on this week: https://github.com/FreeCAD/FreeCAD/pull/3606
FreeCAD master is now fully ported to Py 3.9's C API (not necessarily to changes of the Python modules), boost 1.73 and tons of deprecation warnings of Qt 5.14 but also some general C++ stuff are fixed now. PrzemoF have triggered a few builds for me to catch all the warnings: https://forum.freecadweb.org/viewtopic.php?f=10&t=47348
Btw: The used vtk version there was 8.2.0
FreeCAD master is now fully ported to Py 3.9's C API (not necessarily to changes of the Python modules), boost 1.73 and tons of deprecation warnings of Qt 5.14 but also some general C++ stuff are fixed now. PrzemoF have triggered a few builds for me to catch all the warnings: https://forum.freecadweb.org/viewtopic.php?f=10&t=47348
Btw: The used vtk version there was 8.2.0
- hobbes1069
- Posts: 291
- Joined: Wed Nov 09, 2011 3:49 pm
- Location: Southaven, MS
Re: FreeCAD 0.18.4 fails to build with vtk 9.0
Ok, great! I'll play around with that. I did create a vtk_9.0 branch (haven't pushed it to my fork yet). I think I can help with the CMake part but the API changes will be beyond my time or abilities.
Thanks,
Richard
Thanks,
Richard
Re: FreeCAD 0.18.4 fails to build with vtk 9.0
Is there a vtk porting guide for V9.0 available somewhere?
There are a few API changes that affect the smesh code.
There are a few API changes that affect the smesh code.
- The declaration of vtkCellLinks *vtkUnstructuredGrid::GetCellLinks() has changed to vtkAbstractCellLinks *vtkUnstructuredGrid::GetCellLinks().
It looks like doing a static_cast is sufficient because this is what they did in their example code, too.
https://gitlab.kitware.com/vtk/vtk/-/co ... 458e3bb56a - The declaration of void vtkUnstructuredGrid::GetCellPoints(vtkIdType, vtkIdType&, vtkIdType* &) has changed to void vtkUnstructuredGrid::GetCellPoints(vtkIdType, vtkIdType&, vtkIdType const* &)
Note the "const" in the third argument.
Now, the problem is that in a few places in the smesh code the content of the third variable is modified after calling GetCellPoints(). But now this is not longer possible because it's declared as "const".
See: https://gitlab.kitware.com/vtk/vtk/-/co ... 522df0b95f
In the documentation about GetCellPoints() it's clearly said that the content of the third argument must not be changed afterwards:
https://vtk.org/doc/nightly/html/classv ... f1916e75ca
Examples how to do it with v9
https://gitlab.kitware.com/vtk/vtk/-/co ... 6f1813a7bb
https://gitlab.kitware.com/vtk/vtk/-/co ... e32f7af95b
https://vtk.org/doc/nightly/html/classvtkCellArray.html
- hobbes1069
- Posts: 291
- Joined: Wed Nov 09, 2011 3:49 pm
- Location: Southaven, MS
- hobbes1069
- Posts: 291
- Joined: Wed Nov 09, 2011 3:49 pm
- Location: Southaven, MS
Re: FreeCAD 0.18.4 fails to build with vtk 9.0
In working on updating the cmake config for vtk 9.0 I'm running into some things I don't understand. I'm guessing they were historically needed but may not be anymore:
followed by:
The vtk cmake config already provides ${VTK_AVAILABLE_COMPONENTS}. Additionally, I greped through the source for several of the components in the list and could not find any other instance of it being used anywhere.
Then the logic seems to be "we only require CommonCore, otherwise we figure out what's available and then require it" which doesn't make any sense...
I would think either these modules are a hard requirement, or an optional requirement for specific FreeCAD apps/modules, but I can't find any instance of that being the case in my limited searching.
Fow now I may completely separate the vtk < 9 logic until someone can explain this to me.
Thanks,
Richard
Code: Select all
# if we use smesh we definitely also need vtk, no matter of external or internal smesh
set (VTK_COMPONENTS
CommonDataModel
FiltersVerdict
IOXML
FiltersCore
FiltersGeneral
IOLegacy
FiltersExtraction
FiltersSources
FiltersGeometry
)
# Modules used by FreeCAD on linux and windows only?
if(UNIX OR WIN32)
list(APPEND VTK_COMPONENTS IOMPIParallel ParallelMPI hdf5 FiltersParallelDIY2 RenderingCore InteractionStyle RenderingFreeType RenderingOpenGL2)
endif()
Code: Select all
# Find if other modules are available
foreach(_module ${VTK_COMPONENTS})
list (FIND VTK_MODULES_ENABLED ${_module} _index)
if (${_index} GREATER -1)
list(APPEND AVAILABLE_VTK_COMPONENTS ${_module})
endif()
endforeach()
Then the logic seems to be "we only require CommonCore, otherwise we figure out what's available and then require it" which doesn't make any sense...
Code: Select all
# don't check VERSION 6 as this would exclude VERSION 7
if(AVAILABLE_VTK_COMPONENTS)
message(STATUS "VTK components: ${AVAILABLE_VTK_COMPONENTS}")
find_package(VTK COMPONENTS ${AVAILABLE_VTK_COMPONENTS} REQUIRED NO_MODULE)
else()
message(STATUS "VTK components: not found or used")
find_package(VTK REQUIRED NO_MODULE)
endif()
Fow now I may completely separate the vtk < 9 logic until someone can explain this to me.
Thanks,
Richard