Dolphin fails to compile with multiple errors such as MixedLinearVariationalSolver.cpp:240:23: error: variable ‘dolfin::PETScNestMatrix A’ has initializer but incomplete type
Issue #1119
new
Hello, I am trying to compile fenics from the development source-code on my gentoo system by following the tutorial given at https://fenics.readthedocs.io/en/latest/installation.html#development-version
But compilation (make install) step at dolphin fails with
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp: In member function ‘void dolfin::MixedLinearVariationalSolver::solve(dolfin::MixedLinearVariationalSolver::assembled_system_type)’:
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:240:23: error: variable ‘dolfin::PETScNestMatrix A’ has initializer but incomplete type
240 | PETScNestMatrix A(As);
| ^
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:281:5: error: ‘PETScLUSolver’ was not declared in this scope
281 | PETScLUSolver solver(comm, solver_type);
| ^~~~~~~~~~~~~
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:285:5: error: ‘solver’ was not declared in this scope; did you mean ‘solve’?
285 | solver.set_operator(A);
| ^~~~~~
| solve
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:290:5: error: ‘PETScKrylovSolver’ was not declared in this scope
290 | PETScKrylovSolver solver(comm, solver_type, pc_type);
| ^~~~~~~~~~~~~~~~~
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:291:5: error: ‘solver’ was not declared in this scope; did you mean ‘solve’?
291 | solver.parameters.update(parameters("krylov_solver"));
| ^~~~~~
| solve
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:303:13: error: ‘PETScVector’ was not declared in this scope
303 | as_type<PETScVector>(u)->update_ghost_values();
| ^~~~~~~~~~~
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:303:27: error: no matching function for call to ‘as_type<<expression error> >(std::shared_ptr<dolfin::GenericVector>&)’
303 | as_type<PETScVector>(u)->update_ghost_values();
| ^
In file included from /home/can/dolfin/dolfin/la/GenericTensor.h:38,
from /home/can/dolfin/dolfin/la/GenericMatrix.h:34,
from /home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:27:
/home/can/dolfin/dolfin/la/LinearAlgebraObject.h:64:8: note: candidate: ‘template<class Y, class X> Y& dolfin::as_type(X&)’
64 | Y& as_type(X& x)
| ^~~~~~~
/home/can/dolfin/dolfin/la/LinearAlgebraObject.h:64:8: note: template argument deduction/substitution failed:
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:303:27: error: template argument 1 is invalid
303 | as_type<PETScVector>(u)->update_ghost_values();
| ^
In file included from /home/can/dolfin/dolfin/la/GenericTensor.h:38,
from /home/can/dolfin/dolfin/la/GenericMatrix.h:34,
from /home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:27:
/home/can/dolfin/dolfin/la/LinearAlgebraObject.h:84:24: note: candidate: ‘template<class Y, class X> std::shared_ptr<_Tp> dolfin::as_type(std::shared_ptr<_Tp>)’
84 | std::shared_ptr<Y> as_type(std::shared_ptr<X> x)
| ^~~~~~~
/home/can/dolfin/dolfin/la/LinearAlgebraObject.h:84:24: note: template argument deduction/substitution failed:
/home/can/dolfin/dolfin/fem/MixedLinearVariationalSolver.cpp:303:27: error: template argument 1 is invalid
303 | as_type<PETScVector>(u)->update_ghost_values();
| ^
make[2]: *** [dolfin/CMakeFiles/dolfin.dir/build.make:615: dolfin/CMakeFiles/dolfin.dir/fem/MixedLinearVariationalSolver.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1730: dolfin/CMakeFiles/dolfin.dir/all] Error 2
make: *** [Makefile:160: all] Error 2
Note that this is the same error as shown https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=978206
Suggested solution is to compile with openmpi 4.1.0-3
but I have the error with openmpi 4.1.1rc2.
Any ideas ?
Cheers