Recent updates broke UGGrid in sequential mode

Summary

The recent updates (!111 (merged), !112 (merged), or most likely !96 (merged)) broke UGGrid when installed sequentially (i.e, without MPI). Compiling works, but the linker throws an error related to the Dune::CollectiveCommunication:

Scanning dependencies of target CORE_grid_test
[ 42%] Building CXX object dune/utopia/core/test/CMakeFiles/CORE_grid_test.dir/grid_test.cc.o
[ 50%] Linking CXX executable CORE_grid_test
CMakeFiles/CORE_grid_test.dir/grid_test.cc.o: In function `void __gnu_cxx::new_allocator >::construct>(Dune::UGGrid<2>*)':
grid_test.cc:(.text._ZN9__gnu_cxx13new_allocatorIN4Dune6UGGridILi2EEEE9constructIS3_JEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN4Dune6UGGridILi2EEEE9constructIS3_JEEEvPT_DpOT0_]+0x51): undefined reference to `Dune::UGGrid<2>::UGGrid(Dune::CollectiveCommunication)'
CMakeFiles/CORE_grid_test.dir/grid_test.cc.o: In function `void __gnu_cxx::new_allocator >::construct>(Dune::UGGrid<3>*)':
grid_test.cc:(.text._ZN9__gnu_cxx13new_allocatorIN4Dune6UGGridILi3EEEE9constructIS3_JEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN4Dune6UGGridILi3EEEE9constructIS3_JEEEvPT_DpOT0_]+0x51): undefined reference to `Dune::UGGrid<3>::UGGrid(Dune::CollectiveCommunication)'
collect2: error: ld returned 1 exit status

The error probably went unnoticed because dune-grid doesn't seem to have a sequential compile test in its CI pipeline – which might be an issue of itself.

Steps to reproduce

  1. Install dune-uggrid and dune-grid on Ubuntu (17.10+) without MPI
  2. Compile this code (or similar):
#include <memory>
#include <string>
#include <dune/grid/uggrid.hh>
#include <dune/grid/io/file/gmshreader.hh>

int main (int argc, char** argv) {
    Dune::MPIHelper::instance(argc, argv);

    const std::string filename = "mesh.msh";

    using Grid = Dune::UGGrid<2>;
    auto grid = std::make_shared<Grid>();
    Dune::GridFactory<Grid> factory(grid.get());
    Dune::GmshReader<Grid>::read(factory, filename);
    factory.createGrid();

    return 0;
}

Current bug behavior

UGGrid together with dune-grid structures like GridFactory doesn't compile (link, actually) without MPI.

Expected correct behavior

UGGrid and dune-grid compile both with and without MPI.

Edited by Lukas Riedel