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.