[3rd Party] VTK 9.4 exposes nlohmann::json publicly, causing ODR conflicts
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cmake, cpp
- Lĩnh vực
- build-system, computer-vision
Hướng nghiên cứu
Bắt đầu bằng việc xem xét cách xử lý VTK 9.4 được mô tả trong vtk_nlohmannjson.h cùng các cuộc thảo luận và merge request VTK được liên kết. Tái hiện việc tích hợp PCL 1.15.1 với cấu hình nlohmann::json bên ngoài, sau đó xác định liệu việc nâng cấp VTK, dependency VTK bên ngoài hay một workaround trong PCL có loại bỏ xung đột công khai vtknlohmann hay không.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When using PCL linked with VTK 9.4, the internal nlohmann::json bundled inside VTK (renamed to vtknlohmann in vtk_nlohmannjson.h) is exposed publicly. This causes conflicts when a project also uses a separate nlohmann::json configuration: the compiler raises One Definition Rule (ODR) conflicts for any functions that use the project’s own nlohmann::json. Moreover, the compiler does not understand the nlohmann::json and kind of forces me to use vtknlohmann::json, which is the internal VTK json.
Context
I was trying to add PCL to my project for point cloud visualization and encountered this bug. PCL installation itself works flawlessly (except for a warning “PATH is too long to be changed,” which I resolved manually).
I am on Windows 11 using Visual Studio 2022.
To Reproduce
- Install, configure, and link nlohmann::json for your project using CMake (I used FetchContent).
- Install PCL (latest release) and configure CMake to link it to your project.
- Write a function using your own nlohmann::json.
- Write a function that uses VTK (the error appeared when I tried to visualize a point cloud).
Screenshots / Code snippets
Screenshot showing the conflict:
Code snippet indicated by the last error:
Note the error at line 62: the compiler expects vtknlohmann instead of nlohmann because VTK redefines it here:
My Environment
- OS: Windows 11 24H2
- Compiler: MSVC 19.44.35217.0
- PCL Version: 1.15.1
Possible Solutions
Here are some resources about this problem:
- https://discourse.vtk.org/t/conflict-with-vtknlohmann-and-nlohmann/14977
- https://discourse.vtk.org/t/nlohmann-json-and-vtks-public-api/15131
- https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11854#05ea885e5469ae3672a62ca185b451ca5aaaa3a0
- https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11163
This problem appears to be resolved in VTK 9.5. Possible approaches:
- Upgrade the VTK version distributed with PCL to 9.5.
- Rebuild VTK with
VTK_MODULE_USE_EXTERNAL_VTK_nlohmannjson=ON. - Apply a workaround in PCL to avoid conflicts while keeping VTK 9.4.
Additional Information
This is my first issue submission ever, so sorry if it’s not perfect.
I tried exploring the source code to propose a fix, but haven’t made progress yet. I plan to investigate further.
- Ngôn ngữ chính
- C++
- Star
- 11.2k
- Fork
- 4.7k
- Merge trung bình
- 6 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PointCloudLibrary/pcl
-
kind: bug status: triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
PointCloudLibrary/pcl#6536 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
PointCloudLibrary/pcl#6509 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
kind: bug status: triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
PointCloudLibrary/pcl#6537 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[cmake] QHULL/FLANN dll missing when linking single moduleCó thể đã có người làm @SIDDARTHAREDDY8 đã nhận 6 ngày trước. Đang mởkind: bug module: cmake
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 50/100
PointCloudLibrary/pcl#6522 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
kind: bug status: triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
PointCloudLibrary/pcl#6395 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của PointCloudLibrary/pcl
Issue tương tự
-
needs-format
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Niko1221/Strata#6251 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
[Bug]: NP 管理器文件编辑器里删除键无效Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
metasequoiaime/msime#11666 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
DAE2 crashes on call.without.effects with a non ref.func expressionCó thể đã có người làm @stevenfontanella đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
WebAssembly/binaryen#9404 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
CodeZombie/goodluckOS#178 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
CVO-Org/immersive-cigs-rewrite#313 ·
Maintainer thường phản hồi trong vòng 1 ngày