libVTKIO not found

I inherited some C++ code that uses VTK. I’m on macOS Sequoia 15.7.4.

I installed VTK via homebrew. I can see the install in /usr/local/cellar/vtk/9.5.2_3.

The makefile uses -lvtkIO -lvtkCommon -lvtkFiltering … (among many) as options to the compiler.

The compilation fails with message “ld: library ‘vtkIO’ not found“

I cannot see any libvtkIO in the install location. But I do see a whole lot of libvtkIOxxxxx.dylib files, where xxxxx corresponds to various files like libvtkIOChemistry-9.5.dylib, libvtkIOAMR-9.5.dylib, etc. I did make sure that the compiler has the correct path to the location:

LIB_VTK = -L/usr/local/Cellar/vtk/9.5.2_3/lib -lvtkIO -lvtkCommon -lvtkFiltering …

Can somebody guide me as to how to solve this? I’m new to VTK, I didn’t write the code, and I don’t know much about compilers :(. Do I have to build VTK from scratch ?

Those vtkIO library names are ancient. The only supported way to update the code to a modern VTK is to:

  • use CMake for the project and find_package(VTK) (preferred)
  • update the code to use modern VTK library names (enabling kits in the VTK build will bundle multiple modules into larger libraries; disabling the versioned suffixes would also get you closer)

Note that APIs have changed significantly since that time, so I imagine there are C++ changes to do as well.

Thanks. I downloaded vtk 5.8.0 and attempted to compile it. After some effort I keep getting these 3 failures:

CMake Error at Utilities/vtkhdf5/src/CMakeLists.txt:607 (ADD_CUSTOM_COMMAND):

No TARGET

‘/Users/jsandhu/Downloads/vtk-v5.8.0/Utilities/vtkhdf5/H5Edefin.h’ has been

created in this directory.

CMake Error at Utilities/vtkhdf5/src/CMakeLists.txt:614 (ADD_CUSTOM_COMMAND):

No TARGET

‘/Users/jsandhu/Downloads/vtk-v5.8.0/Utilities/vtkhdf5/H5version.h’ has

been created in this directory.

CMake Error at Utilities/vtkhdf5/src/CMakeLists.txt:621 (ADD_CUSTOM_COMMAND):

No TARGET

‘/Users/jsandhu/Downloads/vtk-v5.8.0/Utilities/vtkhdf5/H5overflow.h’ has

been created in this directory.

These are from these lines of code:

I don’t know cmake, so can’t figure out what this means. Any tips ?

I can’t say directly off-hand, but I suspect an ancient CMake may be necessary too at this point. CMake 4.0 will definitely be grumpy about its minimum required version at least. Can you try a similarly vintaged CMake? 2.8.8 ma do, but 2.8.12 or 3.0.2 is where I’d start.