A colleague told me “it works on my machine”, so we investigated.
The difference was that I was compiling from sources obtained through ‘git clone’ whereas he used the sources obtain from the download pages of the VTK website.
I was able to compile without errors using these sources.
The source from the download pages are version 9.2.6, I suppose it correspond to the tag 9.2.6 from master branch which dates from 3 month ago (https://gitlab.kitware.com/vtk/vtk/-/tags/v9.2.6).
And ‘git clone’ gives the last commit from master, which currently dates from today.
I don’t get why this executable is looking for the IsParallelScope method, not any of the underlying tests are using it. The links fails because VTK::FiltersSMP is not in the TEST_DEPENDS list in the Interaction/Widgets/vtk.module file and so the executable can’t find the IsParallelScope method, I will try too understand why it is looking for it in the first place.
Just to be clear, adding the line:
VTK::FiltersSMP
in the TEST_DEPENDS section of the mentionned files is a hotfix that should solve your issue
I tried to add VTK::FiltersSMP to the end of section of TEST_DEPENDS of file Interaction/Widgets/vtk.module like below image, the error still can be reproduced. Do I must add -DSMP_IMPLEMENTATION_TYPE=Sequential to the cmake command?
My mistake, the important line is not VTK::FiltersSMP but VTK::CommonCore, wich is already here.
I reallydo not get why the IsParallelScope methods is involved and why it is not found.
I will continue to think about this error.
If DBUILD_SHARED_LIBS=ON, this problem does not seem to occur. However, in general, DBUILD_SHARED_LIBS=OFF tends to be used more often on Windows because it is more convenient.
Hello, I also tried to build statically on windows. And I’ve got the same error.
Trying to understand why this is happening, I found the generated file: vtkSMP.h
full path: /Common/Core/vtkSMP.h
and the contents of the file have strange definitions: #define VTK_SMP_ENABLE_OPENMP 0 #define VTK_SMP_ENABLE_SEQUENTIAL 1 #define VTK_SMP_ENABLE_STDTHREAD 1 #define VTK_SMP_ENABLE_TBB 0
When I changed VTK_SMP_ENABLE_STDTHREAD equal to 0
all projects were successfully built #define VTK_SMP_ENABLE_OPENMP 0 #define VTK_SMP_ENABLE_SEQUENTIAL 1 #define VTK_SMP_ENABLE_STDTHREAD 0 #define VTK_SMP_ENABLE_TBB 0
CMakeCache.txt contains two options enabled, when it is configured by cmake by default:
VTK_SMP_ENABLE_SEQUENTIAL:BOOL=ON
VTK_SMP_ENABLE_STDTHREAD:BOOL=ON
VTK_SMP_IMPLEMENTATION_TYPE:STRING=Sequential
You may find more information concerning SMP Tools CMake variable in [our blog].
TLDR:
VTK_ENABLE_* control which backend is enabled. At least one should be set
VTK_SMP_DEFAULT_IMPLEMENTATION_* control which backend to use by default, one and only one will be set to 1
The reported error is a compilation error that seems to arise when compiling STD Thread backend in a static build. It is not clear for me if the error requires at least two backend to be enabled or if STD Thread only build are also impacted.
I also encountered this problem when compiling a static library. I tried the above methods, but they didn’t seem to work. There is no problem when compiling dynamic libraries. The same cmake configuration only turns off BUILD_SHARED_LIBS. How can I successfully compile the static library?
In Visual Studio 2022, for CommonCore module only, adding /std:c++20 to the compile options successfully generates static libraries with DBUILD_SHARED_LIBS=OFF and either DSMP_IMPLEMENTATION_TYPE=Sequential or DSMP_IMPLEMENTATION_TYPE=STDThread in both cases. On the other hand, adding /std:c++14(default) or /std:c++17 failed in all cases.