I tried to update my NGSolve today and got an error for the file “python_comp.cpp” about “optional definedon”. I got the following error message:
------------------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jhauser/Dokumente/NGSolve/ngsuite/ngsolve-build/ngsolve
[ 84%] Performing check_submodules1 step for 'ngsolve'
[ 88%] Performing check_submodules step for 'ngsolve'
[ 92%] Performing build step for 'ngsolve'
-- Found Git: /usr/bin/git (found version "2.11.0")
[ 0%] Built target generate_version_file
[ 9%] Built target ngstd
[ 10%] Built target kernel_generator
[ 10%] Built target kernel_generated
[ 17%] Built target ngbla
[ 18%] Linking CXX shared library libngla.so
[ 32%] Built target ngla
[ 64%] Built target ngfem
[ 64%] Building CXX object comp/CMakeFiles/ngcomp.dir/python_comp.cpp.o
/home/jhauser/Dokumente/NGSolve/ngsuite/ngsolve-src/comp/python_comp.cpp: In function ‘void ExportNgcomp(pybind11::module&)’:
/home/jhauser/Dokumente/NGSolve/ngsuite/ngsolve-src/comp/python_comp.cpp:1122:14: error: ‘optional’ has not been declared
optional<Region> definedon) -> shared_ptr<BaseMatrix>
^~~~~~~~
/home/jhauser/Dokumente/NGSolve/ngsuite/ngsolve-src/comp/python_comp.cpp:1122:22: error: expected ‘,’ or ‘...’ before ‘<’ token
optional<Region> definedon) -> shared_ptr<BaseMatrix>
^
/home/jhauser/Dokumente/NGSolve/ngsuite/ngsolve-src/comp/python_comp.cpp: In lambda function:
/home/jhauser/Dokumente/NGSolve/ngsuite/ngsolve-src/comp/python_comp.cpp:1125:16: error: ‘definedon’ was not declared in this scope
if (definedon) spdefon = make_shared<Region> (*definedon);
^~~~~~~~~
comp/CMakeFiles/ngcomp.dir/build.make:686: die Regel für Ziel „comp/CMakeFiles/ngcomp.dir/python_comp.cpp.o“ scheiterte
make[5]: *** [comp/CMakeFiles/ngcomp.dir/python_comp.cpp.o] Fehler 1
CMakeFiles/Makefile2:501: die Regel für Ziel „comp/CMakeFiles/ngcomp.dir/all“ scheiterte
make[4]: *** [comp/CMakeFiles/ngcomp.dir/all] Fehler 2
Makefile:138: die Regel für Ziel „all“ scheiterte
make[3]: *** [all] Fehler 2
CMakeFiles/ngsolve.dir/build.make:115: die Regel für Ziel „dependencies/Stamp/ngsolve/ngsolve-build“ scheiterte
make[2]: *** [dependencies/Stamp/ngsolve/ngsolve-build] Fehler 2
CMakeFiles/Makefile2:216: die Regel für Ziel „CMakeFiles/ngsolve.dir/all“ scheiterte
make[1]: *** [CMakeFiles/ngsolve.dir/all] Fehler 2
Makefile:149: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2
Do you use a new package that I should install? Thank you for your help in advance.
Hi, which compiler do you use and on what operating system? Can you try to add #include <optional> to the top of the file and see if that fixes the problem?
We need c++17 support for std::optional, which comes with gcc7. Note that up to gcc7.2 there is a critical bug that affects us. So gcc >= 7.3 should work.
Thank you! Did you try different compilers? Do you know which one works?
To patch it up I now used std::experimental::optional with which it seems to compile properly.
The next problem I got with /solve/python_solve.cpp:
I changed the following lines to avoid an error:
330: “if constexpr(is_simd)” into " if (is_simd)"
and
335: “if constexpr(!is_complex)” to “if(!is_complex)”
Afterwards I get the following error:
/ngsuite/ngsolve-src/solve/python_solve.cpp:337:21: error: ‘class
ngfem::BaseMappedIntegrationRule’ has no member named ‘TransformGradientTrans’
mir.TransformGradientTrans(values);
I thought the quickest way to solve it would be a cast of mir to SIMD_BaseMappedIntegrationRule, but this gives quit a few errors as well. Do you have an idea for a quick solution for this?
I would recommend using a newer compiler which supports c++17, either gcc>=7.3 or clang 7. I think compiling them yourself and using a local installation of them is easier than modifying ngsolve and it enables you to upgrade afterwards. For example clang builds using cmake and is quite easy to compile yourself. See here:
Currently there are only debian packages for clang 4.0 and gcc-6 available. So it might take some time to make it work. (Since I can’t simply change my operating system.)
Do you have a list of all the versions from the last half year that I can check which latest version works for me?
Thank you in advance!
I’ve tried it with a local version of gcc-7.4. However I wasn’t able to make it work because of the dependencies.
I’ve not tried clang4 since my sysadmin got me another operating system with gcc-8. With gcc-8 it works now perfectly.