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
freman
Veteran
Posts: 2203
Joined: Tue Nov 27, 2018 10:30 pm

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by freman »

If I try to install smesh on Fed34 it pulls in smesh 8.3.0 and vtk9.0.1 so maybe there are some code changes already applied there to deal with the API changes.
Perhaps it's worth getting the src.rpm from Fed34 and diffing against upstream.

Code: Select all

dnf install smesh
Last metadata expiration check: 2:37:03 ago on Sun 09 May 2021 07:47:54 CEST.
Dependencies resolved.
====================================================================================================================================================================================
 Package                                                Architecture                        Version                                       Repository                           Size
====================================================================================================================================================================================
Installing:
 smesh                                                  x86_64                              8.3.0.4-3.fc34                                fedora                              2.1 M
Installing dependencies:
 double-conversion                                      x86_64                              3.1.5-4.fc34                                  fedora                               48 k
 libGLEW                                                x86_64                              2.1.0-9.fc34                                  fedora                              172 k
 libharu                                                x86_64                              2.3.0-13.fc34                                 fedora                              564 k
 netgen-mesher                                          x86_64                              6.2.2101-2.fc34                               fedora                               18 k
 netgen-mesher-common                                   noarch                              6.2.2101-2.fc34                               fedora                              479 k
 netgen-mesher-devel                                    x86_64                              6.2.2101-2.fc34                               fedora                              413 k
 netgen-mesher-libs                                     x86_64                              6.2.2101-2.fc34                               fedora                              2.7 M
 opencascade-foundation                                 x86_64                              7.5.0-3.fc34                                  fedora                               13 M
 opencascade-modeling                                   x86_64                              7.5.0-3.fc34                                  fedora                               14 M
 opencascade-ocaf                                       x86_64                              7.5.0-3.fc34                                  fedora                              1.2 M
 opencascade-visualization                              x86_64                              7.5.0-3.fc34                                  fedora                              2.0 M
 openslide                                              x86_64                              3.4.1-18.fc34                                 fedora                              109 k
 vtk                                                    x86_64                              9.0.1-3.fc34                                  fedora                               18 M

Transaction Summary
====================================================================================================================================================================================
Install  14 Packages
I tried to use opencascade from repos too but there have been incompatible changes to the install directory sniffing which means /usr/ gets trucated to // and cmake can't find any of the opencascade libraries.

Now I remember why I was still building opencascade from source ! :)
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, I've read your two last posts a few times and perhaps I need more coffee this morning but I'm struggling to figure out what you're trying to do and the relationship between F33/F34. :)
User avatar
freman
Veteran
Posts: 2203
Joined: Tue Nov 27, 2018 10:30 pm

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by freman »

Sorry if I was not clear enough.

I build FreeCAD from master. Two issues:

1.

I had this working fine on Fed33 which I had just upgraded to from Fed31. Due to package version limitations on the latter I had to build a few things from source when I initially installed FC. ( Back before py2 went out of fashion and Fed did not have certain py3 packages ).

IIRC Coin4 and pivy are available as packages with suitable versions on Fed33 so I no longer built those from source.

I updated my opencascade source tree to 7.5.0 ( previously I had 7.3 ). I then realised that Fed33 had 7.5.0 too so there was probably little point in building it. I installed with dnf and tried to re-run cmake on my freecad-build dir. It spits out a load of msgs about missing libs and from the output, it seems the library detection is buggy. The install prefix seems to get lost somehow and it's looking in //lib64 and //include and not finding what it expects.

Now there may be and ENV-VAR that I can set but I got tired of messing and went back to by occt-build dir and ran make install.

2.

Fed33 was fine and I got a working FC master with my usual build method. Foolishly, I then decided to move to "current" Fed34. This only seems to offer vtk version 9. SMESH gets in a fine mess due to the changes in the vtk 9 API, as you know. If I try to use distro smesh it pulls in distro opencascade and I'm back to problem #1. FC cmake fails to find opencascade.

If I build with -DBUILD_SMESH=OFF I avoid the problem so the rest of the build seems fine.

I've not got a lot of need for meshes for most of what I do so it's not a show stopper but I'd like it available, so I was asking where you were with this since you all seem to have a lot of progress.

Hope that's a bit clearer.
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 »

freman wrote: Sun May 09, 2021 1:43 pm
I build FreeCAD from master. Two issues:

1.

I had this working fine on Fed33 which I had just upgraded to from Fed31. Due to package version limitations on the latter I had to build a few things from source when I initially installed FC. ( Back before py2 went out of fashion and Fed did not have certain py3 packages ).

IIRC Coin4 and pivy are available as packages with suitable versions on Fed33 so I no longer built those from source.

I updated my opencascade source tree to 7.5.0 ( previously I had 7.3 ). I then realised that Fed33 had 7.5.0 too so there was probably little point in building it. I installed with dnf and tried to re-run cmake on my freecad-build dir. It spits out a load of msgs about missing libs and from the output, it seems the library detection is buggy. The install prefix seems to get lost somehow and it's looking in //lib64 and //include and not finding what it expects.

Now there may be and ENV-VAR that I can set but I got tired of messing and went back to by occt-build dir and ran make install.
Well there must be some way to make it work since I'm using it for FreeCAD (I also maintain opencascade). I would review my spec file for hints:

https://src.fedoraproject.org/rpms/free ... eecad.spec

Although it doesn't look like I'm doing anything special...

freman wrote: Sun May 09, 2021 1:43 pm
2.

Fed33 was fine and I got a working FC master with my usual build method. Foolishly, I then decided to move to "current" Fed34. This only seems to offer vtk version 9. SMESH gets in a fine mess due to the changes in the vtk 9 API, as you know. If I try to use distro smesh it pulls in distro opencascade and I'm back to problem #1. FC cmake fails to find opencascade.

If I build with -DBUILD_SMESH=OFF I avoid the problem so the rest of the build seems fine.

I've not got a lot of need for meshes for most of what I do so it's not a show stopper but I'd like it available, so I was asking where you were with this since you all seem to have a lot of progress.
I'm using the bundled smesh for now and I also have a patch for vtk9:

https://src.fedoraproject.org/rpms/free ... vtk9.patch

I hope this helps.

Thanks,
Richard
User avatar
freman
Veteran
Posts: 2203
Joined: Tue Nov 27, 2018 10:30 pm

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by freman »

78 #Does not build with current versions of OCCT.
Is that still current ?
Provides: bundled(smesh) = 5.1.2.2

Code: Select all

Patch3:         freecad-vtk9.patch

Code: Select all

From bb9bcbd51df7c3cb76c5823038e4ea0f7e25a9ff Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Mon, 12 Oct 2020 17:56:03 +0200
Subject: [PATCH] Make smesh compile with vtk9
That is presumably a patch which fixes the in-tree version of smesh to get around the vtk9 problem. Look like what I need.

https://src.fedoraproject.org/rpms/free ... vtk9.patch

my tree is in FreeCAD not FreeCAD-0.19.2 , can you tell me where to put the patch in my tree and the patch command to apply it? It ties my head in knots trying work out the right level and the right P argument.

HT to wmayer for disentangling the API changes.

Thanks. That looks like the fix.

Presumably this needs integrating into master with the suitable #ifdefs on VTK9.
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 »

From the root of the source tree a:

Code: Select all

patch -p1 < /path/to/freecad-vtk9.patch
should do it.
User avatar
freman
Veteran
Posts: 2203
Joined: Tue Nov 27, 2018 10:30 pm

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by freman »

worked a treat , many thanks for your help.

after pulling distro's vtk vtk-devel it seems to be building fine with -DBUILD_SMESH=ON
tux68
Posts: 1
Joined: Thu Nov 18, 2021 4:14 am

Re: FreeCAD 0.18.4 fails to build with vtk 9.0

Post by tux68 »

hobbes1069 wrote: Sun May 09, 2021 1:53 pm ...
I'm using the bundled smesh for now and I also have a patch for vtk9:

https://src.fedoraproject.org/rpms/free ... vtk9.patch
Just wanted to say thank you for this patch. I'm new to FreeCAD and am building the Assembly3 fork here locally on Fedora, your work saved the day! Hope it finds its way into the official build.

Cheers,
Sean
Post Reply