FS#72653 - [openvdb][vtk] Missing openvdb cmake config

Attached to Project: Community Packages
Opened by bartus (bartus) - Sunday, 07 November 2021, 10:44 GMT
Last edited by Antonio Rojas (arojas) - Thursday, 25 November 2021, 08:20 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Bruno Pagani (ArchangeGabriel)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Description: Unable to link to `vtk:IOOpenVDB` because of missing `openvdb` cmake configuration.

Additional info:
* openvdb:8.1.0 vtk:9.1

Steps to reproduce:

- create boilerplate CMakeLists.txt
find_package(VTK REQUIRED IOOpenVDB)
- call cmake .
- excerpt from cmake error:
CMake Error at /usr/lib64/cmake/vtk/VTK-vtk-module-find-packages.cmake:603 (find_package):
By not providing "FindOpenVDB.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenVDB", but
CMake did not find one.

Could not find a package configuration file provided by "OpenVDB" with any
of the following names:


Add the installation prefix of "OpenVDB" to CMAKE_PREFIX_PATH or set
"OpenVDB_DIR" to a directory containing one of the above files. If
"OpenVDB" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
/usr/lib64/cmake/vtk/vtk-config.cmake:150 (include)
CMakeLists.txt:2 (find_package)
This task depends upon

Closed by  Antonio Rojas (arojas)
Thursday, 25 November 2021, 08:20 GMT
Reason for closing:  Fixed
Additional comments about closing:  openvdb 9.0.0-4
Comment by bartus (bartus) - Sunday, 07 November 2021, 10:49 GMT
Adding OpenVDB to cmake module path fix the issue.
list(INSERT CMAKE_MODULE_PATH 0 "/usr/lib/cmake/OpenVDB")
Comment by bartus (bartus) - Sunday, 07 November 2021, 11:09 GMT
Also `fmt` is missing from optdepends, required by `VTK:fmt` target
Comment by Antonio Rojas (arojas) - Sunday, 07 November 2021, 11:34 GMT
This is ultimately an openvdb issue: instead of shipping and openVDBConfig.cmake as they should, they are shipping a FindopenVDB.cmake, which is what consumers include to find software that doesn't ship a proper config module. Not sure it's vtk's job to fix their mess.

As a workaround, you can pass -DOpenVDB_CMAKE_PATH=/usr/lib/cmake/OpenVDB to cmake
Comment by Bruno Pagani (ArchangeGabriel) - Sunday, 07 November 2021, 11:42 GMT Comment by bartus (bartus) - Sunday, 07 November 2021, 15:06 GMT
@arojas nope, `cmake -DOpenVDB_CMAKE_PATH=/usr/lib/cmake/OpenVDB` doesn't seems work ¯\_(ツ)_/¯
Comment by bartus (bartus) - Sunday, 07 November 2021, 16:36 GMT
Beside `fmt` also `tbb` is missing form dependency.

Target `VTK:CommonCore` depends on `tbb+openmp` and is required for almost all targets provided in VTK alongside `VTK:vtkm` which handles parallelism and requires `fmt` beside `tbb+openmp`

Should I create a new bug report for that or just leave it here?
Comment by bartus (bartus) - Tuesday, 23 November 2021, 13:38 GMT
Any chance for fixing that, I've to exclude `vtk` from most packages I've built, at least ones that can be built without `vtk`...
Comment by Antonio Rojas (arojas) - Tuesday, 23 November 2021, 13:47 GMT
As a temporary workaround FindopenVDB.cmake could be moved to the cmake search path. Unfortunately cmake only searches in the versioned /usr/share/cmake-xx/Modules path, so that would mean rebuilding openvdb for every minor cmake update (we're already rebuilding a couple of packages so it wouldn't be the end of the world).
Comment by bartus (bartoszek) - Tuesday, 23 November 2021, 16:37 GMT
How about copying FindOpenVDB.cmake form the openvdb package to vtk package cmake config, this way rebuild will be necessary only if openvdb or vtk gets updated
Comment by Sven-Hendrik Haase (Svenstaro) - Tuesday, 23 November 2021, 21:35 GMT
I pushed a workaround with a symlink to FindOpenVDB.cmake. Someone give it a try.
Comment by luca penasa (luke_penn) - Wednesday, 24 November 2021, 10:37 GMT
I am also hitting a lot of troubles from vtk v9 update. Seems that I cannot compile anymore sources that are dependent on vtk, which used to compile fine.
This seems mostly related to what looks like missing dependencies that are not installed together with vtk (or found - as the openmvdb one) but vtk is expecting them to be present at runtime and looks for them.
packages as postgresql ospray openvr python-mpi4py openmpi, adios2 (maybe others) which are not listed as dependencies are actually looked for by cmake at runtime.

Anyway, sorry for the not really useful report. Sven where did you pushed your changes? I´d like to test them out.
Comment by Antonio Rojas (arojas) - Wednesday, 24 November 2021, 11:38 GMT
@luke_penn: That is intentional. Don't use `find_package(VTK)` without a COMPONENTS keyword. The openvdb fix is in 9.0.0-2.
Comment by bartus (bartoszek) - Wednesday, 24 November 2021, 11:43 GMT
Using find_package(vtk) with components is broken too ¯\_(ツ)_/¯ https://gitlab.kitware.com/cmake/cmake/-/issues/22919
Comment by Rose Kunkel (rosekunkel) - Thursday, 25 November 2021, 05:14 GMT
@Svenstaro the symlink you added is broken: the symlink destination shouldn't be relative to `$pkgdir`. Currently the symlink on my system is
/usr/share/cmake-3.22/Modules/FindOpenVDB.cmake -> /build/openvdb/pkg/openvdb/usr/lib/cmake/OpenVDB/FindOpenVDB.cmake
but it should be
/usr/share/cmake-3.22/Modules/FindOpenVDB.cmake -> /usr/lib/cmake/OpenVDB/FindOpenVDB.cmake