VTK v5.4.2 on Ubuntu (in WSL2)

Hello everybody.

I was trying to install VTK v5.4.2 on Ubuntu (in WSL2).
Those are my steps (starting from my home directory):

  1. git clone -b v5.4.2 https://gitlab.kitware.com/vtk/vtk
  2. mkdir VTK-linux
  3. cd VTK-linux
  4. ccmake …/vtk
  5. set the CMAKE_CXX_FLAGS to “-std=c++03” → this was to fix an error I was getting later on during “make install”; the error was about some kind of number format conversion
  6. make install

Here is the problem. “Make install” reaches the 87% and then I get:
vtk/Infovis/vtkOrderStatistics.cxx:107:52: error: call of overloaded ‘div(int, vtkIdType&)’ is ambiguous
107 | div_t q = div( i << 2, this->NumberOfIntervals );
/usr/include/c++/9/cstdlib:213:3: note: candidate: ‘lldiv_t __gnu_cxx::div(long long int, long long int)’
213 | div(long long __n, long long __d)
| ^~~
/usr/include/c++/9/cstdlib:177:3: note: candidate: ‘ldiv_t std::div(long int, long int)’
177 | div(long __i, long __j) { return ldiv(__i, __j); }
| ^~~
make[2]: *** [Infovis/CMakeFiles/vtkInfovis.dir/build.make:609: Infovis/CMakeFiles/vtkInfovis.dir/vtkOrderStatistics.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3193: Infovis/CMakeFiles/vtkInfovis.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

I am completely stuck and no clue on how to fix it.
Could any of you give me some help?
Thanks in advance.

Hi @lbuo

VTK 5.4.2 is ancient (2009) and WSL is not officially supported by VTK, even the last release.

I’d suggest to build VTK 9.2.0 on Windows directly, you can follow the guide here:


To fix that error, try setting VTK_USE_64BIT_IDS=OFF in ccmake.

Brilliant! It worked.
Thanks so much mate!