Document a workaround for OpenMP on Mac
When setting -DVTKm_ENABLE_OPENMP=ON
, we find that AppleClang does not provide a new enough OpenMP version. So we must provide a new compiler; say -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_C_COMPILER=gcc-10
. This causes the build failure
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:525,
from include/vtkm/internal/Configure.h:51,
from ../vtkm/Types.h:13,
from ../vtkm/TypeTraits.h:13,
from ../vtkm/Math.h:16,
from ../vtkm/testing/UnitTestMath.cxx:10:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_ctermid.h:26:10: note: previous declaration with 'C++' linkage
26 | char *ctermid(char *);
| ^~~~~~~
It can be fixed by manually editing the build.ninja
; namely removing all instances of
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
Compilation now proceeds without issue, however, we get the runtime error
$ ctest -R UnitTestStreamlineFilterOPENMP -V
274: Test command: /Users/4nt/vtk-m/build/bin/UnitTests_vtkm_filter_testing "UnitTestStreamlineFilter" "--device=openmp" "-v" "INFO" "--data-dir=/Users/4nt/vtk-m/data/data" "--baseline-dir=/Users/4nt/vtk-m/data/baseline"
274: Test timeout computed to be: 180
274: terminate called after throwing an instance of 'std::runtime_error'
274: what(): locale::facet::_S_create_c_locale name not valid
After googling around a bit, I found a workaround:
$ export LC_ALL=C
$ ctest -R UnitTestStreamlineFilterOPENMP -V
and everything proceeds without issue.
(I see no reason to expend much effort fixing this; but at the same time documenting the workaround seemed like the correct decision as I'll probably refer to it myself. Is this a sensible choice?)
Edited by Nick Thompson