FS#72727 - [vtk] missing core dependency: tbb.

Attached to Project: Community Packages
Opened by bartus (bartus) - Friday, 12 November 2021, 20:44 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:02 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Bruno Pagani (ArchangeGabriel)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description: Core internal deps is missing from the depends array.

Target `VTK::CommonCore` depends on `VTKm` witch, in turn, holds the state of multiprocess framework it was built against and will fail to instantiate if unable to find specifically the TBB one.

```vtk-config.cmake
...
unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND") set("${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm" "ON") if (${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm) find_package(VTKm PATHS "${CMAKE_CURRENT_LIST_DIR}/vtkm" NO_DEFAULT_PATH) if (NOT VTKm_FOUND) set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0) endif () endif ()
...
```

```VTKmConfig.cmake
...
# VTKm_ENABLE_TBB Will be enabled if VTK-m was built with TBB support
...
set(VTKm_ENABLE_TBB "ON")
...

...
if (VTKm_ENABLE_TBB) find_dependency(TBB) if (NOT TBB_FOUND) set(VTKm_FOUND 0) list(APPEND VTKm_NOT_FOUND_REASON "TBB not found: ${TBB_NOT_FOUND_MESSAGE}") endif() endif()
```

Additional info:
* vtk:9.1.0-2
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:02 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/vtk/issues/1
Comment by bartus (bartus) - Friday, 12 November 2021, 20:46 GMT
__Sorry for the formatting issue, fixed code excerpts from the VTK CMake config___

```vtk-config.cmake
unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
set("${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm" "ON")
if (${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm)
find_package(VTKm PATHS "${CMAKE_CURRENT_LIST_DIR}/vtkm" NO_DEFAULT_PATH)
if (NOT VTKm_FOUND)
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
endif ()
endif ()
```

```VTKmConfig.cmake
# VTKm_ENABLE_TBB Will be enabled if VTK-m was built with TBB support

set(VTKm_ENABLE_TBB "ON")

if (VTKm_ENABLE_TBB)
find_dependency(TBB)
if (NOT TBB_FOUND)
set(VTKm_FOUND 0)
list(APPEND VTKm_NOT_FOUND_REASON "TBB not found: ${TBB_NOT_FOUND_MESSAGE}")
endif()
endif()
```
Comment by bartus (bartus) - Sunday, 14 November 2021, 10:18 GMT
The same is applicable to `openmpi`
```vtkm/VTKmConfig.cmake
set(VTKm_ENABLE_OPENMP "ON")
set(VTKm_ENABLE_MPI "ON")
```

```vtkm/cmake/VTKmWrappers.cmake
if(VTKm_ENABLE_MPI AND NOT TARGET MPI::MPI_CXX)
find_package(MPI REQUIRED MODULE)
endif()
```
Comment by Bruno Pagani (ArchangeGabriel) - Sunday, 05 December 2021, 16:16 GMT
tbb was added but in our tests it was the only one really required. Can you confirm?
Comment by bartus (bartoszek) - Monday, 06 December 2021, 21:22 GMT
Nope: Check out this bare PKGBUILD with `vtk,tbb` in depends array building a boilerplate `CMakeLists.txt` witch just calls `find_package(VTK)`

It fails complaining about missing `openmpi`


`PKGBUILD`
```
pkgname=test
pkgver=1.0
pkgrel=1
arch=(x86_64)
depends=(vtk tbb)
makedepends=(cmake)
source=(CMakeLists.txt)
sha256sums=('SKIP')
package() {
cmake -S "$srcdir" -B build
}
```

`CMakeList.txt`
```
cmake_minimum_required(VERSION 3.2)
project(test)
find_package(VTK REQUIRED COMPONENTS vtkCommonCore)
```

`extra-x86_64-build.log`
```
...

-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS)
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.22/Modules/FindMPI.cmake:1830 (find_package_handle_standard_args)
/usr/lib/cmake/vtk/vtkm/cmake/VTKmWrappers.cmake:18 (find_package)
/usr/lib64/cmake/vtk/vtkm/VTKmConfig.cmake:173 (include)
/usr/lib64/cmake/vtk/vtk-config.cmake:129 (find_package)
CMakeLists.txt:3 (find_package)
```
   pkg.txz (0.5 KiB)
Comment by loqs (loqs) - Monday, 06 December 2021, 21:49 GMT
@bartoszek the changes were made in vtk 9.1.0-4 currently in testing. Can you please retest against the testing repositories?
Comment by bartus (bartoszek) - Tuesday, 07 December 2021, 11:37 GMT
Same error with `testing-x86_64-build` should I also test against `staging` repository?
   log.xz (4.6 KiB)
Comment by loqs (loqs) - Tuesday, 07 December 2021, 16:37 GMT
If you add openmpi to makedepends the test PKGBUILD then works? That leaves the question if openmpi should be a dependency of vtk rather than an optional dependency.
Comment by bartus (bartoszek) - Tuesday, 07 December 2021, 17:16 GMT
As shown in https://bugs.archlinux.org/task/72727#comment203663 if vtk was build with openmpi it becomes hard dependency of vtkm. And yes, including openmpi in depends array fixes the `find_package(VTK)` in my example.
Comment by loqs (loqs) - Tuesday, 07 December 2021, 21:16 GMT
opencv 4.5.4-7 uses vtk but not vtkm so it has openmpi in makedepends, opencascade 7.5.3-4 is similar it has a made depend on adios2 which depends on openmpi.
Comment by bartus (bartus) - Tuesday, 07 December 2021, 22:15 GMT
vtk-m is a third party deps of vtk and as far as I can tell there's no way to build vtk without vtk-m.

`find_package(VTKm)` is guarded by `VTK_HAS_VTKm` variable which is set to `ON` if `vtk::vtkm` target exist during build.

https://gitlab.kitware.com/vtk/vtk/-/blob/master/CMake/vtk-config.cmake.in#L127
Comment by bartus (bartus) - Thursday, 09 December 2021, 14:17 GMT
Moreover, `openmp` becomes hard dependency when you build a project with `clang` and links to `vtk:9.1`
Comment by Bruno Pagani (ArchangeGabriel) - Friday, 18 March 2022, 15:01 GMT
Sorry for the huge delay here. So what your saying is that when you try to build something with VTK, you need both openmpi and openmp in addition to TBB for things to work. When I look at things like https://github.com/archlinux/svntogit-community/commit/86c6cc30126b0b71f71ff5dfcbf24f6bd4beb900 also, I’m starting to wonder if VTK is doing things right there. It seems to be bringing way too much dependencies everywhere, so I’m not sure what to do. They are also issues in https://bugs.archlinux.org/task/61655 about current handling of dependencies.

Loading...