FreeCAD 0.18.4 fails to build with vtk 9.0

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
kkremitzki
Veteran
Posts: 2515
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by kkremitzki »

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.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
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

Post by hobbes1069 »

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.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by sgrogan »

hobbes1069 wrote: Fri May 29, 2020 1:20 am So now I'm back in install hell... But at least it builds!
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?
What changed?

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"
User avatar
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

Post by hobbes1069 »

I pinged upstream about a porting guide...

https://discourse.vtk.org/t/vtk-9-0-0/3 ... chard_shaw
User avatar
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

Post by hobbes1069 »

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/
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by wmayer »

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
User avatar
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

Post by hobbes1069 »

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
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by wmayer »

Is there a vtk porting guide for V9.0 available somewhere?

There are a few API changes that affect the smesh code.
User avatar
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

Post by hobbes1069 »

wmayer wrote: Sat Jun 13, 2020 9:05 am Is there a vtk porting guide for V9.0 available somewhere?
The links I provided above is what I was pointed to when I asked that exact question on the vtk forums.

Thanks,
Richard
User avatar
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

Post by hobbes1069 »

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:

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()
followed by:

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()
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...

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()
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
Post Reply