OPM / opm-simulators

OPM Flow and experimental simulators, including components such as well models etc.
http://www.opm-project.org
GNU General Public License v3.0
124 stars 122 forks source link

Master cannot be compiled with DUNE 2.7 and g++-11 #5595

Open blattms opened 2 months ago

blattms commented 2 months ago
/home/mblatt/src/dune-2.7/opm-simulators/opm/simulators/linalg/FlexibleSolver2.cpp:24:1:   required from here
/home/mblatt/src/dune-2.7/opm-simulators/opm/simulators/linalg/FlexibleSolver_impl.hpp:202:24: error: no match for ‘operator=’ (operand types are ‘std::shared_ptr<Dune::InverseOperator<Dune::BlockVector<Dune::FieldVector<double, 2>, std::allocator<Dune::FieldVector<double, 2> > >, Dune::BlockVector<Dune::FieldVector<double, 2>, std::allocator<Dune::FieldVector<double, 2> > > > >’ and ‘std::shared_ptr<Dune::UMFPack<Dune::BCRSMatrix<Opm::MatrixBlock<double, 2, 2>, std::allocator<Opm::MatrixBlock<double, 2, 2> > > > >’)
  202 |             linsolver_ = std::make_shared<Dune::UMFPack<MatrixType>>(linearoperator_for_solver_->getmat(), verbosity, false);
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/memory:77,
                 from /home/mblatt/src/dune-2.7/opm-common/opm/common/OpmLog/OpmLog.hpp:23,
                 from /home/mblatt/src/dune-2.7/opm-common/opm/common/ErrorMacros.hpp:24,
                 from /home/mblatt/src/dune-2.7/opm-simulators/opm/simulators/linalg/FlexibleSolver_impl.hpp:24,
                 from /home/mblatt/src/dune-2.7/opm-simulators/opm/simulators/linalg/FlexibleSolver2.cpp:22:
/usr/include/c++/11/bits/shared_ptr.h:363:9: note: candidate: ‘template<class _Yp> std::shared_ptr<_Tp>::_Assignable<const std::shared_ptr<_Yp>&> std::shared_ptr<_Tp>::operator=(const std::shared_ptr<_Yp>&) [with _Yp = _Yp; _Tp = Dune::InverseOperator<Dune::BlockVector<Dune::FieldVector<double, 2>, std::allocator<Dune::FieldVector<double, 2> > >, Dune::BlockVector<Dune::FieldVector<double, 2>, std::allocator<Dune::FieldVector<double, 2> > > >]’
  363 |         operator=(const shared_ptr<_Yp>& __r) noexcept
      |         ^~~~~~~~

This must have something to do with dune version. It works with 2.9. The conversion was introduced in #5002

bska commented 2 months ago

The Dune version issue may be worth tracking down. For what it's worth, I had a local build against the Dune 2.7.1 release until we merged OPM/opm-common#4157. I don't understand why you mention C++11, however. We've explicitly depended on a C++17 compatible compiler since at least PR OPM/opm-common#2924, and we liberally use C++17 features such as std::filesystem, map<>::insert_or_assign() and std::from_chars(). Am I missing something?

blattms commented 2 months ago

Sorry. I meant g++-11 (Ubuntu 22.04). BTW: OPM/opm-common#4157 only has an effect if you use dunecontrol. I have upcoming PRs fixing this.