OpenFOAM cannot be compiled with gcc 13
Summary
From gcc version 13 and onwards, it is required to #include <cstdint>
to have access to types such as uint64_t
.
OpenFOAM and third-party libraries needs to be patched to allow compilation with gcc 13.
This applies to a lot of projects, for example here is the corresponding issue for VTK.
This is described also in the gcc 13 porting guide .
Steps to reproduce
Trying to compile OpenFOAM v2212 with gcc 13 on my Arch Linux box results in the following error, already in third party libraries (kahip):
error: ‘uint64_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
Workarounds
I have tried setting the C++ standard by exporting FOAM_EXTRA_CXXFLAGS=--std=c++11
, and can confirm this is picked up by the compiler, but this does not address the issue.
So far I have only been able to compile using an older gcc version, e.g. by setting "version=12" in the WM_COMPILE_CONTROL
variable in etc/bashrc before sourcing.