VTK-m: Installing VTK-m as a submodule of VTK

It does not! However this does:

#include <vtkm/cont/Initialize.h>
#include <vtkm/io/reader/VTKDataSetReader.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/rendering/Actor.h>

int main(int argc, char *argv[]) {
    vtkm::cont::Initialize();

    vtkm::io::reader::VTKDataSetReader reader("/home/david/Documents/magField.vtk");

    return 0;
}

Just the vtkm::cont::Initialize(); doesn’t crash.

So, I think it was not do with building. I’d double check the input file. Is it old? Is the producer compliant with the .vtk format? Can your program open something simple and verified like the ones from here: https://people.sc.fsu.edu/~jburkardt/data/vtk/vtk.html ?

I will try that in a minute, but note that I’m not actually reading the set, im just creating a instance.

I randomly chose two of the files rbc_001.vtk and hello.vtk. Still encountering the same problem.

Currently VTK doesn’t use any of the rendering functionality of VTK-m and doesn’t build that component. Therefore that is why you can’t find the rendering libraries. You will need to modify ThirdParty/vtkm/vtkvtkm/CMakeLists.txt to enable VTKm_ENABLE_RENDERING.

What I can’t get my head around is why only this functions when I use vtkm::filter::Contour but comment out the actor.

The version of VTK-m included in VTK is not the same as the VTK-m 1.5 release, and the classes are not the same. When you use headers a different version of a project compared to the libraries you will get random crashes as the data layouts / functions are different.

Hi Robert,

I reconfiguered the CMakeLists.txt you told me to and then configured VTK using cmake-gui. (Note: The option didn’t show up in the gui but VTKm_ENABLE_GL_CONTEXT did so I figured it worked.)

Then I did sudo make -j8 and sudo make -j8 install in the bin directory of VTK. All completed without errors.

So now I can see the Actor.h in following location:
/usr/local/include/vtk-9.0/vtkvtkm/vtk-m/vtkm/rendering/Actor.h

But the build still fails with this output:

david@david-mint:~/Documents/minimal/bin$ make clean
david@david-mint:~/Documents/minimal/bin$ make
[100%] Building CXX object CMakeFiles/minimal.dir/main.cpp.o
[100%] Linking CXX executable minimal
CMakeFiles/minimal.dir/main.cpp.o: In function `main':
main.cpp:(.text.main+0x1e5): undefined reference to `vtkm::rendering::Actor::Actor(vtkm::cont::DynamicCellSetBase<vtkm::List<vtkm::cont::CellSetStructured<2>, vtkm::cont::CellSetStructured<3>, vtkm::cont::CellSetExplicit<vtkm::cont::StorageTagBasic, vtkm::cont::StorageTagBasic, vtkm::cont::StorageTagBasic>, vtkm::cont::CellSetSingleType<vtkm::cont::StorageTagBasic> > > const&, vtkm::cont::CoordinateSystem const&, vtkm::cont::Field const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/minimal.dir/build.make:247: recipe for target 'minimal' failed
make[2]: *** [minimal] Error 1
CMakeFiles/Makefile2:95: recipe for target 'CMakeFiles/minimal.dir/all' failed
make[1]: *** [CMakeFiles/minimal.dir/all] Error 2
Makefile:103: recipe for target 'all' failed
make: *** [all] Error 2

The path still looks weird, shouldn’t it be more like this?
/usr/local/include/vtk-9.0/vtkm/rendering/Actor.h

Should I try a symlink? Would it make sense to completley remove the standalone VTKm install?

Would it make sense to completley remove the standalone VTKm install?

Yes you should do that so you don’t accidentally mix components

But the build still fails with this output:

undefined reference to vtkm::rendering::Actor

I expect you will need to update your example to link against the vtkm_rendering target.

The path still looks weird, shouldn’t it be more like this?

That path is correct, it is versioned like that so it has the same path in the build directory and the install directory.

So I’m not actually quite sure how to uninstall since make uninstall is no target.
Would it be enough to remove all vtkm-1.5 directories from /usr/local/include and /usr/local/lib/cmake?

Would it be enough to remove all vtkm-1.5 directories from /usr/local/include and /usr/local/lib/cmake?

You will also need to delete any vtkm libs/archives from /usr/lib/

Okay, so I removed both VTK and VTKm and did a fresh install with your instructions. Now VTKm is linked correctly and working. Thank you very much.