Trilinos icon indicating copy to clipboard operation
Trilinos copied to clipboard

MueLu has a circular header inclusion problem.

Open bangerth opened this issue 10 months ago • 11 comments

I can't compile Trilinos 15.1.1 because of a circular header inclusion problem. Specifically, this is the issue:

In file included from /.../build/trilinos-release-15-1-1/packages/muelu/src/MueLu_Hierarchy.hpp:2,
                 from /.../unpack/Trilinos-trilinos-release-15-1-1/packages/muelu/src/Headers/MueLu.hpp:69,
                 from /.../unpack/Trilinos-trilinos-release-15-1-1/packages/muelu/src/Operators/MueLu_CreateXpetraPreconditioner.hpp:5
7,
                 from /.../unpack/Trilinos-trilinos-release-15-1-1/packages/muelu/src/Operators/MueLu_RefMaxwell_def.hpp:89,
                 from /.../build/trilinos-release-15-1-1/packages/muelu/src/MueLu_RefMaxwell.hpp:2,
                 from /.../unpack/Trilinos-trilinos-release-15-1-1/packages/muelu/src/Smoothers/MueLu_RefMaxwellSmoother_decl.hpp:59,
                 from /.../build/trilinos-release-15-1-1/packages/muelu/src/MueLu_RefMaxwellSmoother.hpp:1,
                 from /.../unpack/Trilinos-trilinos-release-15-1-1/packages/muelu/src/Smoothers/MueLu_DirectSolver_def.hpp:61,
                 from /.../build/trilinos-release-15-1-1/packages/muelu/src/MueLu_DirectSolver.hpp:2,
                 from /.../unpack/Trilinos-trilinos-release-15-1-1/packages/muelu/src/MueCentral/MueLu_FactoryManager_def.hpp:57,
                 from /.../build/trilinos-release-15-1-1/packages/muelu/src/MueLu_FactoryManager.hpp:2,
                 from /.../unpack/Trilinos-trilinos-release-15-1-1/packages/muelu/src/MueCentral/MueLu_Hierarchy_decl.hpp:66,

The issue is that MueLu_Hierarchy_decl.hpp is supposed to declare the Hierarchy class, but before it gets around to it it works through the motions of many #includes and ends up in MueLu_Hierarchy.hpp which in line 2 #includes MueLu_Hierarchy_def.hpp which proceeds to define the Hierarchy class members before we have ever seen a class declaration. Unsurprisingly, this leads to compiler errors:

/raid/bangerth/bin/debian-2024/tmp/unpack/Trilinos-trilinos-release-15-1-1/packages/muelu/src/MueCentral/MueLu_Hierarchy_def.hpp:78:65: error: invalid use of incomplete type 'class MueLu::Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node>'
   78 | Hierarchy<Scalar, LocalOrdinal, GlobalOrdinal, Node>::Hierarchy()
      |                                                                 ^

bangerth avatar Apr 17 '24 23:04 bangerth