trelau / SMESH

Mesh module from the Salome Platform
GNU Lesser General Public License v2.1
50 stars 31 forks source link

Support for OCCT 7.6.0 #54

Closed trelau closed 2 years ago

trelau commented 2 years ago

https://dev.opencascade.org/content/open-cascade-technology-760-released

Tobias-Fischer commented 2 years ago

+1 - the build currently fails on the conda-forge feedstock for occt 7.6: https://github.com/conda-forge/smesh-feedstock/pull/52

basnijholt commented 2 years ago

This would be great!

Currently, it's blocking the building of FreeCAD too with the VTK 9.1.0, which is build with OCCT 7.6.0.

trelau commented 2 years ago

thanks for feedback. i can probably get to this in the next week or so

Tobias-Fischer commented 2 years ago

Hi @trelau - did you have a chance to look at this? Many thanks in advance!

trelau commented 2 years ago

@Tobias-Fischer not yet, unfortunately. the day job has been keeping me busy lately :)

looooo commented 2 years ago

here is the commit for freecad-internal smesh to work with occt7.6: https://github.com/FreeCAD/FreeCAD/commit/6f3b00d67ec0bd0072b7b493e2a38d2a2e3af27d

looooo commented 2 years ago

I tried to work on this and applying some diff from the posted commit. But now I am stuck with this:

Building CXX object src/SMESH/CMakeFiles/Controls.dir/src/Controls/SMESH_Controls.cxx.o
FAILED: src/SMESH/CMakeFiles/Controls.dir/src/Controls/SMESH_Controls.cxx.o 
${PREFIX}/_build_env/bin/x86_64-conda-linux-gnu-c++ -DCSFDB -DControls_EXPORTS -DHAVE_FREEIMAGE -DHAVE_FREETYPE -DHAVE_LIMITS_H -DHAVE_OPENGL_EXT -DHAVE_RAPIDJSON -DHAVE_VTK -DHAVE_XLIB -DLIN -DOCC_CONVERT_SIGNALS -DVTK_OPENGL2_BACKEND -D_OCC64 -Dkiss_fft_scalar=double -I${PREFIX}/_h_env/include/opencascade -I${PREFIX}/work/SMESH/src/SMESH/src/Controls -I${PREFIX}/work/SMESH/src/Kernel/src/Basics -I${PREFIX}/work/SMESH/src/Kernel/src/SALOMELocalTrace -I${PREFIX}/work/SMESH/src/Kernel/src/Utils -I${PREFIX}/work/SMESH/src/Geom/src/GEOMUtils -I${PREFIX}/work/SMESH/src/SMESH/src/SMDS -I${PREFIX}/work/SMESH/src/SMESH/src/SMESHDS -I${PREFIX}/work/SMESH/src/SMESH/src/SMESHUtils -isystem ${PREFIX}/_h_env/include/vtk-9.1 -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem ${PREFIX}/_h_env/include -fdebug-prefix-map=${PREFIX}/work=/usr/local/src/conda/smesh-9.7.0.1 -fdebug-prefix-map=${PREFIX}/_h_env=/usr/local/src/conda-prefix -O3 -DNDEBUG -fPIC -Wno-deprecated -std=c++11 -MD -MT src/SMESH/CMakeFiles/Controls.dir/src/Controls/SMESH_Controls.cxx.o -MF src/SMESH/CMakeFiles/Controls.dir/src/Controls/SMESH_Controls.cxx.o.d -o src/SMESH/CMakeFiles/Controls.dir/src/Controls/SMESH_Controls.cxx.o -c ${PREFIX}/work/SMESH/src/SMESH/src/Controls/SMESH_Controls.cxx
In file included from ${PREFIX}/_build_env/x86_64-conda-linux-gnu/include/c++/9.4.0/memory:65,
                 from ${PREFIX}/_h_env/include/boost/smart_ptr/detail/sp_counted_impl.hpp:35,
                 from ${PREFIX}/_h_env/include/boost/smart_ptr/detail/shared_count.hpp:27,
                 from ${PREFIX}/_h_env/include/boost/smart_ptr/shared_ptr.hpp:17,
                 from ${PREFIX}/_h_env/include/boost/shared_ptr.hpp:17,
                 from ${PREFIX}/work/SMESH/src/SMESH/src/SMESHDS/SMESH_Controls.hxx:32,
                 from ${PREFIX}/work/SMESH/src/SMESH/src/Controls/SMESH_ControlsDef.hxx:26,
                 from ${PREFIX}/work/SMESH/src/SMESH/src/Controls/SMESH_Controls.cxx:23:
${PREFIX}/_build_env/x86_64-conda-linux-gnu/include/c++/9.4.0/bits/stl_uninitialized.h: In instantiation of '_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::move_iterator<SMESH::Controls::ElementsOnShape::Classifier*>; _ForwardIterator = SMESH::Controls::ElementsOnShape::Classifier*]':
${PREFIX}/_build_env/x86_64-conda-linux-gnu/include/c++/9.4.0/bits/stl_uninitialized.h:307:37:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::move_iterator<SMESH::Controls::ElementsOnShape::Classifier*>; _ForwardIterator = SMESH::Controls::ElementsOnShape::Classifier*; _Tp = SMESH::Controls::ElementsOnShape::Classifier]'
${PREFIX}/_build_env/x86_64-conda-linux-gnu/include/c++/9.4.0/bits/stl_uninitialized.h:329:2:   required from '_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = SMESH::Controls::ElementsOnShape::Classifier*; _ForwardIterator = SMESH::Controls::ElementsOnShape::Classifier*; _Allocator = std::allocator<SMESH::Controls::ElementsOnShape::Classifier>]'
${PREFIX}/_build_env/x86_64-conda-linux-gnu/include/c++/9.4.0/bits/vector.tcc:659:48:   required from 'void std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp, _Alloc>::size_type) [with _Tp = SMESH::Controls::ElementsOnShape::Classifier; _Alloc = std::allocator<SMESH::Controls::ElementsOnShape::Classifier>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
${PREFIX}/_build_env/x86_64-conda-linux-gnu/include/c++/9.4.0/bits/stl_vector.h:937:4:   required from 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = SMESH::Controls::ElementsOnShape::Classifier; _Alloc = std::allocator<SMESH::Controls::ElementsOnShape::Classifier>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
${PREFIX}/work/SMESH/src/SMESH/src/Controls/SMESH_Controls.cxx:4442:51:   required from here
${PREFIX}/_build_env/x86_64-conda-linux-gnu/include/c++/9.4.0/bits/stl_uninitialized.h:127:72: error: static assertion failed: result type must be constructible from value type of input range
  127 |       static_assert(is_constructible<_ValueType2, decltype(*__first)>::value,
      |                                                                        ^~~~~
[140/265] Building CXX object src/SMESH/CMakeFiles/SMDS.dir/src/SMDS/SMDS_Mesh.cxx.o
ninja: build stopped: subcommand failed.

@wwmayer do you run into the same issue when trying to port smesh to occt7.6? @trelau

wwmayer commented 2 years ago

But now I am stuck with this:

Fails for me, too. The problem is the struct ElementsOnShape::Classifier in SMESH_Controls.cxx because it has a member variable of the type GeomAPI_ProjectPointOnSurf and that has a member of type Extrema_GenExtPS. For Extrema_GenExtPS the copy-constructor is disabled so that it's not possible to make a copy of GeomAPI_ProjectPointOnSurf and thus no copy of ElementsOnShape::Classifier.

But somewhere in SMESH_Controls.cxx this is requested and thus leads to the compiler error. The trick to solve the issue is a hand-written copy-constructor of ElementsOnShape::Classifier the omits the GeomAPI_ProjectPointOnSurf member.

looooo commented 2 years ago

Thanks, did you make these changes to the freecad internal smesh? If so can you share the commit? @wwmayer

wwmayer commented 2 years ago

Thanks, did you make these changes to the freecad internal smesh? If so can you share the commit?

No, because it's too old and doesn't have that file. But I prepared a patch file with all my changes. It was a bit tricky to create the patch because for the build I didn't have to change the files that are under git control but a free copy. port_occ76.patch.txt

looooo commented 2 years ago

Thanks a lot, I will have a look in the next days.

looooo commented 2 years ago

@trelau what is the best workflow to create the patches?

trelau commented 2 years ago

been out of the loop for a bit now, but if i understand the question, i remember editing files, checking the patch difference in git GUI, then copy/pasting that into a patch file and trying it out locally (i think there is a python file that attempts to apply patch files). there is surely a better way to make patch files that is what i remember doing

trelau commented 2 years ago

I got a chance to work on this project a bit and got updated to:

I have a local branch for OCCT 7.6 but I'm battling one last compiler error on windows. I'll share that branch in the next day or so.

trelau commented 2 years ago

Branch is here https://github.com/trelau/SMESH/tree/occt76

But, failing due to one issue with "SMESH::Controls::ElementsOnShape::Classifier". one example here https://github.com/trelau/SMESH/runs/6290166835?check_suite_focus=true#step:8:737