AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Mozilla Public License 2.0
2.59k stars 643 forks source link

[BUG] Remove FindTBB.cmake #1741

Open mwestphal opened 8 months ago

mwestphal commented 8 months ago

OpenVDB should not provide a FindTBB.cmake (or any Find*.cmake for that matter) because it overrides local TBBConfig.cmake and may miss some components.

In my specific case, it results to the following:

-- OpenVDB ABI Version: 10
CMake Error at /usr/lib/cmake/TBB/TBBTargets.cmake:42 (message):
  Some (but not all) targets in this export set were already defined.

  Targets Defined: TBB::tbb

  Targets not yet defined: TBB::tbbmalloc, TBB::tbbmalloc_proxy,
  TBB::tbbbind_2_5, TBB::irml

Call Stack (most recent call first):
  /usr/lib/cmake/TBB/TBBConfig.cmake:1 (include)
  /home/glow/dev/f3d/deps/install/lib/cmake/vtk-9.3/FindTBB.cmake:75 (find_package)
  /home/glow/dev/f3d/deps/install/lib/cmake/OpenVDB/FindOpenVDB.cmake:493 (find_package)
  /home/glow/dev/f3d/deps/install/lib/cmake/vtk-9.3/VTK-vtk-module-find-packages.cmake:209 (find_package)
  /home/glow/dev/f3d/deps/install/lib/cmake/vtk-9.3/vtk-config.cmake:159 (include)
  cmake/f3dPlugin.cmake:170 (find_package)
  plugins/vdb/CMakeLists.txt:25 (f3d_plugin_build)

Although the FindTBB.cmake providen by OpenVDB does not appear in the stack, removing it solves the issue.

Removing FindTBB.cmake seems to be finxing the issue, but you must be providing it for a reason, so some care may need to be taken for removal.

rafalfaro18 commented 2 months ago

I'm having a similar issue, I have another project in my computer called OpenUSD and I have its bin and lib paths added to my PATH environment variable and for some reason it's adding the tbb from that project in the build\openvdb\openvdb\openvdb_shared.vcxproj file so I get the error:

openvdb_static.vcxproj -> D:\openvdb\build\openvdb\openvdb\Release\libopenvdb.lib
LINK : fatal error LNK1104: cannot open file 'tbb12.lib' [D:\openvdb\build\openvdb\openvdb\openvdb_shared.vcxproj]

if I manually replace the usd tbb.lib path to the tbb12.lib file that I got from vcpkg "C:\vcpkg\installed\x64-windows\lib\tbb12.lib" then I can continue past the error.

Funny enough then I get another error that it cannot create C:/Program Files/OpenVDB/... so I had to run PowerShell in administrator mode.

After that I finally got it correctly compiled and installed in C:/Program Files/OpenVDB

Except that it didn't copy all the dlls to C:\Program Files\OpenVDB\bin so vdb_print.exe wasn't working I had to manually copy the missing dlls from the build folder.

LCM1999 commented 1 month ago

I had same issue, "Could NOT find TBB (missing: tbb)", and finally solve it by removing it FindTBB.cmake.