[SOLVED] FC compilation fails with OCCT 7.6.0 beta.

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
fcaduser
Posts: 446
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

[SOLVED] FC compilation fails with OCCT 7.6.0 beta.

Post by fcaduser »

Hello FC team.

Last FC code pulled today.
Debian 11, but clearly it is not related to the environment.

Thanks.

Code: Select all

mainuser@station1:~/software/freecad_source/build_2021-10-07$ make -j 1
[  1%] Built target SMDS
[  1%] Built target Driver
[  2%] Built target DriverSTL
[  2%] Built target SMESHDS
[  2%] Built target DriverUNV
[  2%] Built target DriverDAT
[  2%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o
In file included from /home/mainuser/software/occt-cf9dd8a/include/opencascade/Message_ProgressScope.hxx:23,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/Message_ProgressIndicator.hxx:157,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/Message_ProgressRange.hxx:111,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/BRepBuilderAPI_MakeShape.hxx:28,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/BRepPrimAPI_MakeBox.hxx:25,
                 from /home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp:69:
/home/mainuser/software/occt-cf9dd8a/include/opencascade/Precision.hxx:98:7: error: redefinition of ‘class Precision’
   98 | class Precision
      |       ^~~~~~~~~
In file included from /home/mainuser/software/occt-cf9dd8a/include/opencascade/Extrema_POnSurf.lxx:15,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/Extrema_POnSurf.hxx:75,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/Extrema_ExtPElS.hxx:27,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/Extrema_ExtPS.hxx:24,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/ShapeAnalysis_Surface.hxx:20,
                 from /home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/inc/SMESH_MesherHelper.hxx:37,
                 from /home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/src/SMESH/SMESH_Mesh.cpp:34:
/home/mainuser/software/occt-cf9dd8a/include/opencascade/Precision.hxx:98:7: note: previous definition of ‘class Precision’
   98 | class Precision
      |       ^~~~~~~~~
make[2]: *** [src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/build.make:407 : src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_Mesh.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:2474 : src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/all] Erreur 2
make: *** [Makefile:149 : all] Erreur 2
Last edited by fcaduser on Mon Oct 11, 2021 11:35 am, edited 1 time in total.
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by wmayer »

This is the culprit: https://github.com/FreeCAD/FreeCAD/blob ... sh.cpp#L67
When compiling SMESH_Mesh.cpp at an earlier point the compiler includes Precision.hxx and later it will be included again. Now because of undefining _Precision_HeaderFile the compiler sees the class declaration a second time and thus raises an error.

This change has added the line: https://git.salome-platform.org/gitweb/ ... 5d477a1813

Originally the line was added to an older branch with: https://git.salome-platform.org/gitweb/ ... 59d68d1095

The commit log message:
0020062: [CEA 295] Type coherence in *.i files
doesn't tell why it was done.

My guess is that the OCCT version from 2008 had a mistake with a file guard.
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by wmayer »

Please try again.
git commit 77b198048a
fcaduser
Posts: 446
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by fcaduser »

Testing... Thank you.
fcaduser
Posts: 446
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by fcaduser »

One step beyond...

Code: Select all

mainuser@station1:~/software/freecad_source/build_2021-10-07$ make
[  1%] Built target SMDS
[  1%] Built target Driver
[  2%] Built target DriverSTL
[  2%] Built target SMESHDS
[  2%] Built target DriverUNV
[  2%] Built target DriverDAT
[  2%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_MeshAlgos.cpp.o
In file included from /home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshAlgos.cpp:42:
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:39:40: error: ‘gp_Sphere’ does not name a type; did you mean ‘gp_Other’?
   39 |   Standard_EXPORT IntAna_Quadric(const gp_Sphere& Sph);
      |                                        ^~~~~~~~~
      |                                        gp_Other
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:42:40: error: ‘gp_Cylinder’ does not name a type
   42 |   Standard_EXPORT IntAna_Quadric(const gp_Cylinder& Cyl);
      |                                        ^~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:42:19: error: ‘IntAna_Quadric::IntAna_Quadric(const int&)’ cannot be overloaded with ‘IntAna_Quadric::IntAna_Quadric(const int&)’
   42 |   Standard_EXPORT IntAna_Quadric(const gp_Cylinder& Cyl);
      |                   ^~~~~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:39:19: note: previous declaration ‘IntAna_Quadric::IntAna_Quadric(const int&)’
   39 |   Standard_EXPORT IntAna_Quadric(const gp_Sphere& Sph);
      |                   ^~~~~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:45:40: error: ‘gp_Cone’ does not name a type
   45 |   Standard_EXPORT IntAna_Quadric(const gp_Cone& Cone);
      |                                        ^~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:45:19: error: ‘IntAna_Quadric::IntAna_Quadric(const int&)’ cannot be overloaded with ‘IntAna_Quadric::IntAna_Quadric(const int&)’
   45 |   Standard_EXPORT IntAna_Quadric(const gp_Cone& Cone);
      |                   ^~~~~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:39:19: note: previous declaration ‘IntAna_Quadric::IntAna_Quadric(const int&)’
   39 |   Standard_EXPORT IntAna_Quadric(const gp_Sphere& Sph);
      |                   ^~~~~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:51:42: error: ‘gp_Sphere’ does not name a type; did you mean ‘gp_Other’?
   51 |   Standard_EXPORT void SetQuadric (const gp_Sphere& Sph);
      |                                          ^~~~~~~~~
      |                                          gp_Other
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:54:42: error: ‘gp_Cone’ does not name a type
   54 |   Standard_EXPORT void SetQuadric (const gp_Cone& Con);
      |                                          ^~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:54:24: error: ‘void IntAna_Quadric::SetQuadric(const int&)’ cannot be overloaded with ‘void IntAna_Quadric::SetQuadric(const int&)’
   54 |   Standard_EXPORT void SetQuadric (const gp_Cone& Con);
      |                        ^~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:51:24: note: previous declaration ‘void IntAna_Quadric::SetQuadric(const int&)’
   51 |   Standard_EXPORT void SetQuadric (const gp_Sphere& Sph);
      |                        ^~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:57:42: error: ‘gp_Cylinder’ does not name a type
   57 |   Standard_EXPORT void SetQuadric (const gp_Cylinder& Cyl);
      |                                          ^~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:57:24: error: ‘void IntAna_Quadric::SetQuadric(const int&)’ cannot be overloaded with ‘void IntAna_Quadric::SetQuadric(const int&)’
   57 |   Standard_EXPORT void SetQuadric (const gp_Cylinder& Cyl);
      |                        ^~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:51:24: note: previous declaration ‘void IntAna_Quadric::SetQuadric(const int&)’
   51 |   Standard_EXPORT void SetQuadric (const gp_Sphere& Sph);
      |                        ^~~~~~~~~~
make[2]: *** [src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/build.make:420 : src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_MeshAlgos.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:2474 : src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/all] Erreur 2
make: *** [Makefile:149 : all] Erreur 2
mainuser@station1:~/software/freecad_source/build_2021-10-07$ make
[  1%] Built target SMDS
[  1%] Built target Driver
[  2%] Built target DriverSTL
[  2%] Built target SMESHDS
[  2%] Built target DriverUNV
[  2%] Built target DriverDAT
[  2%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_MeshAlgos.cpp.o
In file included from /home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/src/SMESH/SMESH_MeshAlgos.cpp:42:
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:39:40: error: ‘gp_Sphere’ does not name a type; did you mean ‘gp_Other’?
   39 |   Standard_EXPORT IntAna_Quadric(const gp_Sphere& Sph);
      |                                        ^~~~~~~~~
      |                                        gp_Other
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:42:40: error: ‘gp_Cylinder’ does not name a type
   42 |   Standard_EXPORT IntAna_Quadric(const gp_Cylinder& Cyl);
      |                                        ^~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:42:19: error: ‘IntAna_Quadric::IntAna_Quadric(const int&)’ cannot be overloaded with ‘IntAna_Quadric::IntAna_Quadric(const int&)’
   42 |   Standard_EXPORT IntAna_Quadric(const gp_Cylinder& Cyl);
      |                   ^~~~~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:39:19: note: previous declaration ‘IntAna_Quadric::IntAna_Quadric(const int&)’
   39 |   Standard_EXPORT IntAna_Quadric(const gp_Sphere& Sph);
      |                   ^~~~~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:45:40: error: ‘gp_Cone’ does not name a type
   45 |   Standard_EXPORT IntAna_Quadric(const gp_Cone& Cone);
      |                                        ^~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:45:19: error: ‘IntAna_Quadric::IntAna_Quadric(const int&)’ cannot be overloaded with ‘IntAna_Quadric::IntAna_Quadric(const int&)’
   45 |   Standard_EXPORT IntAna_Quadric(const gp_Cone& Cone);
      |                   ^~~~~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:39:19: note: previous declaration ‘IntAna_Quadric::IntAna_Quadric(const int&)’
   39 |   Standard_EXPORT IntAna_Quadric(const gp_Sphere& Sph);
      |                   ^~~~~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:51:42: error: ‘gp_Sphere’ does not name a type; did you mean ‘gp_Other’?
   51 |   Standard_EXPORT void SetQuadric (const gp_Sphere& Sph);
      |                                          ^~~~~~~~~
      |                                          gp_Other
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:54:42: error: ‘gp_Cone’ does not name a type
   54 |   Standard_EXPORT void SetQuadric (const gp_Cone& Con);
      |                                          ^~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:54:24: error: ‘void IntAna_Quadric::SetQuadric(const int&)’ cannot be overloaded with ‘void IntAna_Quadric::SetQuadric(const int&)’
   54 |   Standard_EXPORT void SetQuadric (const gp_Cone& Con);
      |                        ^~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:51:24: note: previous declaration ‘void IntAna_Quadric::SetQuadric(const int&)’
   51 |   Standard_EXPORT void SetQuadric (const gp_Sphere& Sph);
      |                        ^~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:57:42: error: ‘gp_Cylinder’ does not name a type
   57 |   Standard_EXPORT void SetQuadric (const gp_Cylinder& Cyl);
      |                                          ^~~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:57:24: error: ‘void IntAna_Quadric::SetQuadric(const int&)’ cannot be overloaded with ‘void IntAna_Quadric::SetQuadric(const int&)’
   57 |   Standard_EXPORT void SetQuadric (const gp_Cylinder& Cyl);
      |                        ^~~~~~~~~~
/home/mainuser/software/occt-cf9dd8a/include/opencascade/IntAna_Quadric.hxx:51:24: note: previous declaration ‘void IntAna_Quadric::SetQuadric(const int&)’
   51 |   Standard_EXPORT void SetQuadric (const gp_Sphere& Sph);
      |                        ^~~~~~~~~~
make[2]: *** [src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/build.make:420 : src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/src/SMESH/SMESH_MeshAlgos.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:2474 : src/3rdParty/salomesmesh/CMakeFiles/SMESH.dir/all] Erreur 2
make: *** [Makefile:149 : all] Erreur 2
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by wmayer »

That's an internal bug in OCCT. In previous versions of IntAna_Quadric.hxx there were some forward declarations:

Code: Select all

class gp_Pln;
class gp_Sphere;
class gp_Cylinder;
class gp_Cone;
class gp_Ax3;
and they have been removed now: https://git.dev.opencascade.org/gitweb/ ... b2e#patch7

Removing the forward declarations is a regression and doesn't make any sense to me.

So, to work around that all what you can do is adding the needed header files before including IntAna_Quadric.hxx. So add this to SMESH_MeshAlgos.cpp

Code: Select all

#include <gp_Pln.hxx>
#include <gp_Sphere.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Cone.hxx>
fcaduser
Posts: 446
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by fcaduser »

What's next.

Code: Select all

[  1%] Built target SMDS
[  1%] Built target Driver
[  2%] Built target DriverSTL
[  2%] Built target SMESHDS
[  2%] Built target DriverUNV
[  2%] Built target DriverDAT
[  3%] Built target SMESH
[  3%] Built target MEFISTO2
[  3%] Building CXX object src/3rdParty/salomesmesh/CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Adaptive1D.cpp.o
/home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Adaptive1D.cpp: In constructor ‘{anonymous}::TriaTreeData::TriaTreeData(const TopoDS_Face&, {anonymous}::ElementBndBoxTree*)’:
/home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Adaptive1D.cpp:321:33: error: ‘class Poly_Triangulation’ has no member named ‘Nodes’; did you mean ‘Node’?
  321 |       myNodes           = & tr->Nodes();
      |                                 ^~~~~
      |                                 Node
/home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Adaptive1D.cpp:322:43: warning: ‘const Poly_Array1OfTriangle& Poly_Triangulation::Triangles() const’ is deprecated: Deprecated method, Triangle() should be used instead [-Wdeprecated-declarations]
  322 |       myPolyTrias       = & tr->Triangles();
      |                                           ^
In file included from /home/mainuser/software/occt-cf9dd8a/include/opencascade/Poly_ListOfTriangulation.hxx:20,
                 from /home/mainuser/software/occt-cf9dd8a/include/opencascade/BRep_Tool.hxx:30,
                 from /home/mainuser/software/freecad_source/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_Adaptive1D.cpp:40:
/home/mainuser/software/occt-cf9dd8a/include/opencascade/Poly_Triangulation.hxx:318:32: note: declared here
  318 |   const Poly_Array1OfTriangle& Triangles() const { return myTriangles; }
      |                                ^~~~~~~~~
make[2]: *** [src/3rdParty/salomesmesh/CMakeFiles/StdMeshers.dir/build.make:108 : src/3rdParty/salomesmesh/CMakeFiles/StdMeshers.dir/src/StdMeshers/StdMeshers_Adaptive1D.cpp.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:2535 : src/3rdParty/salomesmesh/CMakeFiles/StdMeshers.dir/all] Erreur 2
make: *** [Makefile:149 : all] Erreur 2
user1234
Veteran
Posts: 3345
Joined: Mon Jul 11, 2016 5:08 pm

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by user1234 »

Does it make sense to update the smesh sources? They seems to be outdated (7.7.1 vs. 9.7.0) and make problems on more places, like

here: https://forum.freecadweb.org/viewtopic.php?t=51997
and here: https://forum.freecadweb.org/viewtopic.php?t=62566

I have compiled smesh successfully, but are not able use it as external library in FreeCAD. Got to many cmake errors, they i do not understand.

Greetings
user1234
fcaduser
Posts: 446
Joined: Wed Feb 19, 2014 6:53 pm
Location: Near Paris, France

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by fcaduser »

At this point my goal is to pinpoint all the modifications needed that can be straightforwardly done to the FC code without hassle. Concerning the third parties codes, we'll see point by point what can be done.
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FC compilation fails with OCCT 7.6.0 beta.

Post by wmayer »

To shorten the ping-pong here I have fetched the 7.6 sources and use it for FreeCAD.
Post Reply