[BUG] OpenVDB::nanovdb imported target lacks NANOVDB_USE_OPENVDB, so NanoVDB<->OpenVDB conversion does not compile against an installed OpenVDB
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cmake, cpp
- Domain
- build-system
Research direction
Start in cmake/FindOpenVDB.cmake around lines 799–802 and compare the installed OpenVDB::nanovdb target with nanovdb/nanovdb/CMakeLists.txt lines 339–346. Configure and build vdb_tool with OPENVDB_BUILD_CORE=OFF and OPENVDB_TOOL_USE_NANO=ON against an installed OpenVDB. Done means the imported target provides the same OpenVDB support interface and NanoVDB conversion compiles.
Written by the indexing model from the issue text.
Description
Symptom:
Configuring vdb_tool against an installed OpenVDB (OPENVDB_BUILD_CORE=OFF, OPENVDB_TOOL_USE_NANO=ON) succeeds - find_package(OpenVDB COMPONENTS nanovdb) reports the component found - but compilation fails in Tool.h:
Tool.h:2400: error: 'openToNanoVDB' is not a member of 'nanovdb::tools'
nanovdb/tools/CreateNanoGrid.h:333: error: '... openvdb::Grid<...>' has no member named 'gridClass'
nanovdb/tools/CreateNanoGrid.h:332: error: '... openvdb::Grid<...>' has no member named 'map'
i.e. CreateNanoGrid.h is being compiled with its OpenVDB support disabled, and treats an openvdb::Grid as a NanoVDB grid.
Cause:
the macro is only ever set on the in-tree target. nanovdb/nanovdb/CMakeLists.txt lines 339–346:
if(NANOVDB_USE_OPENVDB)
...
target_link_libraries(nanovdb INTERFACE openvdb) # or OpenVDB::openvdb
target_compile_definitions(nanovdb INTERFACE -DNANOVDB_USE_OPENVDB)
endif()
The installed package's equivalent, cmake/FindOpenVDB.cmake lines 799-802, creates OpenVDB::nanovdb as an INTERFACE IMPORTED target carrying only INTERFACE_INCLUDE_DIRECTORIES - no NANOVDB_USE_OPENVDB definition and no link dependency on OpenVDB::openvdb. The in-tree and installed targets therefore have different contracts, and every consumer that worked in-tree breaks when built standalone.
Reproduce:
cmake --install --prefix , then configure any project with find_package(OpenVDB REQUIRED COMPONENTS openvdb nanovdb) and compile a TU that calls nanovdb::tools::createNanoGrid(openvdb_grid). vdb_tool with OPENVDB_BUILD_CORE=OFF -DOPENVDB_TOOL_USE_NANO=ON is a ready-made case. Observed on v13.1.0 (4d95e56b), Ubuntu 24.04, gcc 13.3, CMake 3.28.
Suggested fix:
in FindOpenVDB.cmake, when both the openvdb and nanovdb components are requested, give OpenVDB::nanovdb the same interface the in-tree target has:
set_target_properties(OpenVDB::nanovdb PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "NANOVDB_USE_OPENVDB"
INTERFACE_LINK_LIBRARIES "OpenVDB::openvdb")
(Optionally also NANOVDB_USE_TBB / NANOVDB_USE_BLOSC / NANOVDB_USE_ZIP, mirroring lines 61-88 of openvdb_cmd/vdb_tool/CMakeLists.txt, which currently re-derives those itself but not NANOVDB_USE_OPENVDB.)
Not covered by CI:
no workflow builds vdb_tool standalone with NanoVDB.
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 777
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 33
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AcademySoftwareFoundation/openvdb
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
AcademySoftwareFoundation/openvdb#2344 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AcademySoftwareFoundation/openvdb#2341 · 2 comments ·
-
nanovdb
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AcademySoftwareFoundation/openvdb#2274 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 65/100
AcademySoftwareFoundation/openvdb#2147 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AcademySoftwareFoundation/openvdb#1896 ·
All issues in AcademySoftwareFoundation/openvdb
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
infiniflow/infinity#3502 ·