Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMESH fails to build with GCC 12 #57

Open
hobbes1069 opened this issue Jan 30, 2022 · 5 comments
Open

SMESH fails to build with GCC 12 #57

hobbes1069 opened this issue Jan 30, 2022 · 5 comments

Comments

@hobbes1069
Copy link

Fedora Rawhide has updated to gcc 12 and several packages are failing to build including SMESH which has the following error:

/builddir/build/BUILD/smesh-9.7.0.1/src/SMESH/src/SMESH/SMESH_MeshEditor.cxx: In member function 'void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement*, const std::vector<std::_Rb_tree_iterator<std::pair<const SMDS_MeshNode* const, std::__cxx11::list<const SMDS_MeshNode*> > > >&, std::__cxx11::list<const SMDS_MeshElement*>&, size_t, SMESH_SequenceOfElemPtr&)':
/builddir/build/BUILD/smesh-9.7.0.1/src/SMESH/src/SMESH/SMESH_MeshEditor.cxx:4310:18: error: no matching function for call to 'swap(std::vector<bool>::reference, std::vector<bool>::reference)'
 4310 |         std::swap( isSingleNode[0], isSingleNode[1] );
      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/12/bits/exception_ptr.h:43,
                 from /usr/include/c++/12/exception:168,
                 from /usr/include/boost/smart_ptr/bad_weak_ptr.hpp:21,
                 from /usr/include/boost/smart_ptr/detail/shared_count.hpp:25,
                 from /usr/include/boost/smart_ptr/shared_ptr.hpp:17,
                 from /usr/include/boost/shared_ptr.hpp:17,
                 from /builddir/build/BUILD/smesh-9.7.0.1/src/SMESH/src/SMESHDS/SMESH_Controls.hxx:32,
                 from /builddir/build/BUILD/smesh-9.7.0.1/src/SMESH/src/SMESH/SMESH_MeshEditor.hxx:33,
                 from /builddir/build/BUILD/smesh-9.7.0.1/src/SMESH/src/SMESH/SMESH_MeshEditor.cxx:27:
/usr/include/c++/12/bits/move.h:196:5: note: candidate: 'std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = _Bit_reference; _Require<__not_<__is_tuple_like<_Tp> >, is_move_constructible<_Tp>, is_move_assignable<_Tp> > = void]' (near match)
  196 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/12/bits/move.h:196:5: note:   conversion of argument 2 would be ill-formed:
/builddir/build/BUILD/smesh-9.7.0.1/src/SMESH/src/SMESH/SMESH_MeshEditor.cxx:4310:51: error: cannot bind non-const lvalue reference of type 'std::_Bit_reference&' to an rvalue of type 'std::vector<bool>::reference'
 4310 |         std::swap( isSingleNode[0], isSingleNode[1] );
      |                                     ~~~~~~~~~~~~~~^
/usr/include/c++/12/bits/move.h:220:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> std::__enable_if_t<std::__is_swappable<_Tp>::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])'
  220 |     swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
      |     ^~~~
@StefanBruens
Copy link

This should be reported to the upstream SALOME project. It may even be fixed already, upstream is at 9.8.0.

Two solutions:

  • Use a recent GCC libstdc++, see gcc-mirror/gcc@5943493
  • Use a more standards compliant solution, working an all compilers:
    std::vector<bool>::swap( isSingleNode[0], isSingleNode[1] );

@hobbes1069
Copy link
Author

I added a using std::swap and changed it to just swap and that fixed it for now.

@trelau
Copy link
Owner

trelau commented May 17, 2022

@hobbes1069 is this still relevant or can it be closed?

@hobbes1069
Copy link
Author

9.8.0.2 still exhibits the same problem for me.

My workaround for now is:

Index: smesh-9.7.0.1/src/SMESH/src/SMESH/SMESH_MeshEditor.cxx
===================================================================
--- smesh-9.7.0.1.orig/src/SMESH/src/SMESH/SMESH_MeshEditor.cxx
+++ smesh-9.7.0.1/src/SMESH/src/SMESH/SMESH_MeshEditor.cxx
@@ -4304,10 +4304,11 @@ void SMESH_MeshEditor::sweepElement(cons
       bool sameOrder = ( Abs( i2 - i1 ) == 1 ) ? ( i2 > i1 ) : ( i2 < i1 );
       if ( sameOrder )
       {
-        std::swap( itNN[0],    itNN[1] );
+		std::swap( itNN[0],    itNN[1] );
         std::swap( prevNod[0], prevNod[1] );
         std::swap( nextNod[0], nextNod[1] );
-        std::swap( isSingleNode[0], isSingleNode[1] );
+        using std::swap;
+        swap( isSingleNode[0], isSingleNode[1] );
         if ( nbSame > 0 )
           sames[0] = 1 - sames[0];
         iNotSameNode = 1 - iNotSameNode;

@hobbes1069
Copy link
Author

While a local build succeeded the official build failed with a new error on Fedora Rawhide:

/builddir/build/BUILD/smesh-9.8.0.2/src/Netgen/libsrc/core/table.hpp: At global scope:
/builddir/build/BUILD/smesh-9.8.0.2/src/Netgen/libsrc/core/table.hpp:104:26: error: redefinition of 'size_t* ngcore::TablePrefixSum(FlatArray<unsigned int, unsigned int>)'
  104 |   NETGEN_INLINE size_t * TablePrefixSum (FlatArray<size_t> entrysize)
      |                          ^~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants