Compile error when both MPI and GUI are turned on

Dear all,

Following the description from

I am trying to compile netgen/ngsolve on Debian 9.0 with cmake flags

cmake -DCMAKE_INSTALL_PREFIX=${BASEDIR}/ngsolve-install \
      -DUSE_GUI=ON \
      -DUSE_MPI=ON \

This results in a compile error when build the target visual

[ 42%] Linking CXX shared library
[ 42%] Built target mesh
Scanning dependencies of target visual
[ 42%] Building CXX object libsrc/visualization/CMakeFiles/visual.dir/meshdoc.cpp.o
[ 43%] Building CXX object libsrc/visualization/CMakeFiles/visual.dir/mvdraw.cpp.o
/home/andre/ngsuite/ngsolve-src/external_dependencies/netgen/libsrc/visualization/mvdraw.cpp: In member function ‘void netgen::VisualScene::Broadcast()’:
/home/andre/ngsuite/ngsolve-src/external_dependencies/netgen/libsrc/visualization/mvdraw.cpp:835:5: error: ‘vssolution’ was not declared in this scope
     vssolution.Broadcast ();
libsrc/visualization/CMakeFiles/visual.dir/build.make:86: recipe for target 'libsrc/visualization/CMakeFiles/visual.dir/mvdraw.cpp.o' failed
make[8]: *** [libsrc/visualization/CMakeFiles/visual.dir/mvdraw.cpp.o] Error 1
CMakeFiles/Makefile2:1333: recipe for target 'libsrc/visualization/CMakeFiles/visual.dir/all' failed

With either one of the MPI/GUI options turned off, the code compiles just fine.

I did a quick grepping of the source code and understood that many vssolution.MEMBERFUNCTION() calls have been replaced by netgen::GetVSSolution().MEMBERFUNCTION() calls.
So while not being sure what I was doing, I tried my luck and replaced the corresponding line 835 in mvdraw.cpp by


The the code compiled fine, but I now get a linking error

Scanning dependencies of target netgen
[ 99%] Building CXX object ng/CMakeFiles/netgen.dir/ngappinit.cpp.o
[ 99%] Building CXX object ng/CMakeFiles/netgen.dir/onetcl.cpp.o
[100%] Linking CXX executable netgen undefined reference to `netgen::vssolution'
collect2: error: ld returned 1 exit status
ng/CMakeFiles/netgen.dir/build.make:142: recipe for target 'ng/netgen' failed
make[8]: *** [ng/netgen] Error 1

Any advice on how to fix this compile/linking error?

Thanks and best,

Hello Andre,

Thank you for the concise report. I fixed the build errors of both Netgen and NGSolve on master.
Note that the GUI might currently be in an unstable state if you run netgen with mpi, like
mpirun -np x netgen


Many thanks for the superfast fixes, works like a charm now!