Compiler and gcc version

On my cluster I only have access to GCC 7.3 or 8.2.

Compiling ngsolve with gcc 8.2 seems to be unsupported. Compiling ngsolve with 7.3 gives me the following errors

[ 30%] Building CXX object fem/CMakeFiles/ngfem.dir/diffop_grad.cpp.o
/home/janwdp/ngsuite/ngsolve-src/fem/diffop_grad.cpp: In static member function ‘static std::shared_ptr<ngfem::CoefficientFunction> ngfem::DiffOpGradientBoundary<D, FEL>::DiffShape(std::shared_ptr<ngfem::CoefficientFunction>, std::shared_ptr<ngfem::CoefficientFunction>) [with int D = 2; FEL = ngfem::ScalarFiniteElement<1>]’:
/home/janwdp/ngsuite/ngsolve-src/fem/diffop_grad.cpp:24:23: internal compiler error: in assign_temp, at function.c:968
     n -> SetDimensions( Array<int> ( { dim, 1 } ) );
0x91e471 assign_temp(tree_node*, int, int)
0x7e0a6f initialize_argument_information
0x7e0a6f expand_call(tree_node*, rtx_def*, int)
0x8d3abd expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
0x7f0226 expand_expr
0x7f0226 expand_call_stmt
0x7f0226 expand_gimple_stmt_1
0x7f0226 expand_gimple_stmt
0x7f110f expand_gimple_basic_block
0x7f6276 execute
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <> for instructions.
make[5]: *** [fem/CMakeFiles/ngfem.dir/diffop_grad.cpp.o] Error 1
make[4]: *** [fem/CMakeFiles/ngfem.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [dependencies/Stamp/ngsolve/ngsolve-build] Error 2
make[1]: *** [CMakeFiles/ngsolve.dir/all] Error 2
make: *** [all] Error 2

Any advice on how to build ngsolve using either of these gcc versions?

gcc 8.2 has a critical bug affecting NGSolve, and it seems like gcc 7.3 also…
You can try to change this line of code to

Array<int> a({dim, 1});
n -> SetDimensions(a)

and see if it compiles.
If not, you can either ask your admins to update to recent compiler versions or compile a recent version yourself and use it.