Dolphin version 2019.2.0.dev0 fails to compile with multiple errors such as MixedLinearVariationalSolver.cpp:240:23: error: variable ‘dolfin::PETScNestMatrix A’ has initializer but incomplete type

Hello, I am trying to compile fenics (version 2019.2.0.dev0) from the development source-code on my gentoo system by following the tutorial given at Installation — FEniCS Project documentation

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 ?
Is Dolphin still maintained ? Or should I go directly with Dolphin-x ?

Cheers,

That bug report suggests the error is in OpenMPI, not dolfin.

Likely it’s related to the interplay between OpenMPI, PMIX and UCX, which would need to be configured appropriately to work together. The only simple thing I can suggest is to try what Debian did: the changelog for openmpi 4.1.0-2 says they switched to an internal pmix. Perhaps 4.1.1 still does not support an external PMIX 4 library.

2 Likes

Ok so after further digging I saw in
/home/can/dolfin/build/CMakeFiles/CMakeError.log

the following error:

error "PETSc was configured with one OpenMPI mpi.h version but now appears to be compiling using a different OpenMPI mpi.h version"

Which linked to this discussion here

Solution was to recompile openmpi + petsc alltogether again via

`emerge petsc openmpi`

followed by

 make clean
 cmake -DCMAKE_INSTALL_PREFIX=$PWD/../local

that lead to

-- Checking for one of the modules 'craypetsc_real;PETSc'
-- Test PETSC_TEST_RUNS with shared library linking - Success
-- Found PETSc: TRUE (found suitable version "3.13.1", minimum required is "3.7")
-- Checking for one of the modules 'crayslepc_real;SLEPc'

Hope that help other gentoo users.

Now I hit another compilation error at

[ 38%] Building CXX object dolfin/CMakeFiles/dolfin.dir/geometry/IntersectionConstruction.cpp.o
    /home/can/dolfin/dolfin/geometry/IntersectionConstruction.cpp: In static member function ‘static std::vector<dolfin::Point> dolfin::IntersectionConstruction::intersection_segment_segment_2d(const dolfin::Point&, const dolfin::Point&, const dolfin::Point&, const dolfin::Point&)’:
    /home/can/dolfin/dolfin/geometry/IntersectionConstruction.cpp:442:24: error: ‘min_element’ is not a member of ‘std’; did you mean ‘tuple_element’?
      442 |   const auto it = std::min_element(oo.begin(), oo.end());
          |                        ^~~~~~~~~~~
          |                        tuple_element
    make[2]: *** [dolfin/CMakeFiles/dolfin.dir/build.make:1200: dolfin/CMakeFiles/dolfin.dir/geometry/IntersectionConstruction.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:1730: dolfin/CMakeFiles/dolfin.dir/all] Error 2
    make: *** [Makefile:160: all] Error 2

which is fixed by adding

#include <algorithm>

in the header of

/home/can/dolfin/dolfin/geometry/IntersectionConstruction.cpp

as suggested here

Cheers,
Can

1 Like