visp icon indicating copy to clipboard operation
visp copied to clipboard

Build issue around nlohmann_json usage with VTK 9.2.0 or more recent version used as an embedded 3rdparty by PCL

Open fspindle opened this issue 4 months ago • 0 comments

CI based on .github/workflows/ubuntu-dep-src.yml produces the following build issue:

[ 20%] Building CXX object modules/gui/CMakeFiles/visp_gui.dir/src/pointcloud/vpPclViewer.cpp.o
In file included from /home/runner/VTK/build/install/include/vtk-9.4/vtkAbstractArray.h:61,
                 from /home/runner/VTK/build/install/include/vtk-9.4/vtkDataArray.h:26,
                 from /home/runner/VTK/build/install/include/vtk-9.4/vtkPoints.h:18,
                 from /home/runner/pcl/build/install/include/pcl-1.14/pcl/visualization/point_cloud_geometry_handlers.h:50,
                 from /home/runner/pcl/build/install/include/pcl-1.14/pcl/visualization/common/actor_map.h:40,
                 from /home/runner/pcl/build/install/include/pcl-1.14/pcl/visualization/pcl_visualizer.h:48,
                 from /home/runner/work/visp/visp/modules/gui/include/visp3/gui/vpPclViewer.h:49,
                 from /home/runner/work/visp/visp/modules/gui/src/pointcloud/vpPclViewer.cpp:43:
/home/runner/VTK/build/install/include/vtk-9.4/vtkAbstractArray.h:82:3: error: ‘vtknlohmann’ does not name a type; did you mean ‘nlohmann’?
   82 |   nlohmann::json SerializeValues();
      |   ^~~~~~~~

This issue occurs on Ubuntu 22.04 or later when nlohmann_json is installed as a system dependency using

$ sudo apt install nlohmann-json3-dev

and when VTK 9.4.0.rc2 and PCL 1.14.1 are build from source.

This issue can be reproduced with the following Dockerfile.

Note that this issue doesn't occur with PCL 1.12.1 that comes with VTK 9.1.0.

This issue is due to a conflict between nlohmann_json installed as a system dependency and nlohmann_json embedded in VTK 9.2.0 or later as a third-party.

fspindle avatar Oct 18 '24 12:10 fspindle