PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.93k stars 4.61k forks source link

PCL Build Error: undefined reference to boost date_time library #4995

Closed hcaslan closed 2 years ago

hcaslan commented 2 years ago

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 PCL Version: latest version

I'm getting the following error message while trying to install PCL

[ 23%] Building CXX object tools/CMakeFiles/pcl_pcd2vtk.dir/pcd2vtk.cpp.o /usr/bin/ld: CMakeFiles/pcl_openni_pcd_recorder.dir/openni_pcd_recorder.cpp.o: in function 'boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::iso_format, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)': openni_pcd_recorder.cpp:(.text._ZN5boost9date_time15month_formatterINS_9gregorian10greg_monthENS0_10iso_formatIcEEcE12format_monthERKS3_RSo[_ZN5boost9date_time15month_formatterINS_9gregorian10greg_monthENS0_10iso_formatIcEEcE12format_monthERKS3_RSo]+0x4c): undefined reference to boost::gregorian::greg_month::as_short_string() const' /usr/bin/ld: openni_pcd_recorder.cpp:(.text._ZN5boost9date_time15month_formatterINS_9gregorian10greg_monthENS0_10iso_formatIcEEcE12format_monthERKS3_RSo[_ZN5boost9date_time15month_formatterINS_9gregorian10greg_monthENS0_10iso_formatIcEEcE12format_monthERKS3_RSo]+0x6f): undefined reference toboost::gregorian::greg_month::as_long_string() const' collect2: error: ld returned 1 exit status make[2]: [io/tools/CMakeFiles/pcl_openni_pcd_recorder.dir/build.make:232: bin/pcl_openni_pcd_recorder] Error 1 make[1]: [CMakeFiles/Makefile2:1942: io/tools/CMakeFiles/pcl_openni_pcd_recorder.dir/all] Error 2 make[1]: Waiting for unfinished jobs.... [ 23%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/point_cloud_handlers.cpp.o [ 23%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/pcl_visualizer.cpp.o [ 23%] Linking CXX executable ../../bin/pcl_example_get_max_min_coordinates [ 23%] Linking CXX executable ../../bin/pcl_hdl_grabber [ 23%] Linking CXX executable ../../bin/pcl_converter [ 24%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/histogram_visualizer.cpp.o [ 24%] Built target pcl_hdl_grabber [ 24%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/common/common.cpp.o [ 24%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/common/io.cpp.o [ 24%] Built target pcl_example_get_max_min_coordinates [ 24%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/common/shapes.cpp.o [ 24%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/common/ren_win_interact_map.cpp.o [ 24%] Linking CXX executable ../bin/pcl_compute_cloud_error [ 24%] Built target pcl_converter [ 24%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/cloud_viewer.cpp.o [ 24%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/image_viewer.cpp.o /home/hcaslan/pcl/visualization/src/interactor_style.cpp: In member function ‘virtual void pcl::visualization::PCLVisualizerInteractorStyle::OnKeyDown()’: /home/hcaslan/pcl/visualization/src/interactor_style.cpp:676:40: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 676 | vtkVertexBufferObjectMapper mapper = static_cast<vtkVertexBufferObjectMapper>(act.actor->GetMapper ()); | ^~ In file included from /home/hcaslan/pcl/visualization/src/interactor_style.cpp:74: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ /home/hcaslan/pcl/visualization/src/interactor_style.cpp:676:88: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 676 | vtkVertexBufferObjectMapper mapper = static_cast<vtkVertexBufferObjectMapper>(act.actor->GetMapper ()); | ^ In file included from /home/hcaslan/pcl/visualization/src/interactor_style.cpp:74: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ /home/hcaslan/pcl/visualization/src/interactor_style.cpp:717:40: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 717 | vtkVertexBufferObjectMapper mapper = static_cast<vtkVertexBufferObjectMapper>(act.actor->GetMapper ()); | ^~ In file included from /home/hcaslan/pcl/visualization/src/interactor_style.cpp:74: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ /home/hcaslan/pcl/visualization/src/interactor_style.cpp:717:88: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 717 | vtkVertexBufferObjectMapper mapper = static_cast<vtkVertexBufferObjectMapper>(act.actor->GetMapper ()); | ^ In file included from /home/hcaslan/pcl/visualization/src/interactor_style.cpp:74: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ [ 24%] Linking CXX executable ../bin/pcl_pcd2vtk [ 24%] Built target pcl_compute_cloud_error [ 24%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/window.cpp.o [ 24%] Linking CXX executable ../bin/pcl_add_gaussian_noise [ 25%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/range_image_visualizer.cpp.o [ 25%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/common/float_image_utils.cpp.o [ 25%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/vtk/pcl_image_canvas_source_2d.cpp.o [ 25%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/vtk/pcl_context_item.cpp.o [ 25%] Built target pcl_add_gaussian_noise [ 25%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/vtk/vtkRenderWindowInteractorFix.cpp.o [ 25%] Built target pcl_pcd2vtk [ 25%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/pcl_painter2D.cpp.o [ 25%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/pcl_plotter.cpp.o [ 25%] Linking CXX executable ../bin/pcl_vtk2pcd [ 25%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/vtk/vtkVertexBufferObject.cxx.o [ 26%] Building CXX object visualization/CMakeFiles/pcl_visualization.dir/src/vtk/vtkVertexBufferObjectMapper.cxx.o /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp: In member function ‘void pcl::visualization::PCLVisualizer::createActorFromVTKDataSet(const vtkSmartPointer&, vtkSmartPointer&, bool) const’: /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:1179:21: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 1179 | vtkSmartPointer mapper = vtkSmartPointer::New (); | ^~~~~~~ In file included from /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:65: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:1179:75: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 1179 | vtkSmartPointer mapper = vtkSmartPointer::New (); | ^~~~~~~ In file included from /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:65: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp: In member function ‘void pcl::visualization::PCLVisualizer::createActorFromVTKDataSet(const vtkSmartPointer&, vtkSmartPointer&, bool) const’: /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:1257:21: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 1257 | vtkSmartPointer mapper = vtkSmartPointer::New (); | ^~~~~~~ In file included from /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:65: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:1257:75: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 1257 | vtkSmartPointer mapper = vtkSmartPointer::New (); | ^~~~~~~ In file included from /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:65: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp: In member function ‘bool pcl::visualization::PCLVisualizer::updateColorHandlerIndex(const string&, int)’: /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:3044:34: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 3044 | vtkVertexBufferObjectMapper mapper = static_cast<vtkVertexBufferObjectMapper>(am_it->second.actor->GetMapper ()); | ^~ In file included from /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:65: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:3044:82: warning: ‘vtkVertexBufferObjectMapper’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 3044 | vtkVertexBufferObjectMapper mapper = static_cast<vtkVertexBufferObjectMapper>(am_it->second.actor->GetMapper ()); | ^ In file included from /home/hcaslan/pcl/visualization/src/pcl_visualizer.cpp:65: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:39:13: note: declared here 39 | PCL_EXPORTS vtkVertexBufferObjectMapper : public vtkMapper | ^~~~~~~ In file included from /home/hcaslan/pcl/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx:19: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:117:26: warning: ‘vtkVertexBufferObject’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 117 | vtkVertexBufferObject vertexVbo; | ^~~~~ In file included from /home/hcaslan/pcl/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx:18: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObject.h:44:13: note: declared here 44 | PCL_EXPORTS vtkVertexBufferObject : public vtkObject | ^~~~~ In file included from /home/hcaslan/pcl/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx:19: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:118:26: warning: ‘vtkVertexBufferObject’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 118 | vtkVertexBufferObject indiceVbo; | ^~~~~ In file included from /home/hcaslan/pcl/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx:18: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObject.h:44:13: note: declared here 44 | PCL_EXPORTS vtkVertexBufferObject : public vtkObject | ^~~~~ In file included from /home/hcaslan/pcl/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx:19: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:119:26: warning: ‘vtkVertexBufferObject’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 119 | vtkVertexBufferObject colorVbo; | ^~~~ In file included from /home/hcaslan/pcl/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx:18: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObject.h:44:13: note: declared here 44 | PCL_EXPORTS vtkVertexBufferObject : public vtkObject | ^~~~~ In file included from /home/hcaslan/pcl/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx:19: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObjectMapper.h:120:26: warning: ‘vtkVertexBufferObject’ is deprecated: The OpenGL backend of VTK is deprecated. Please switch to the OpenGL2 backend. (It will be removed in PCL 1.13) [-Wdeprecated-declarations] 120 | vtkVertexBufferObject normalVbo; | ^~~~~ In file included from /home/hcaslan/pcl/visualization/src/vtk/vtkVertexBufferObjectMapper.cxx:18: /home/hcaslan/pcl/visualization/include/pcl/visualization/vtk/vtkVertexBufferObject.h:44:13: note: declared here 44 | PCL_EXPORTS vtkVertexBufferObject : public vtkObject | ^~~~~ [ 26%] Built target pcl_vtk2pcd [ 26%] Linking CXX shared library ../lib/libpcl_visualization.so [ 26%] Built target pcl_visualization [ 26%] Linking CXX shared library ../lib/libpcl_surface.so [ 26%] Built target pcl_surface make: [Makefile:152: all] Error 2

mvieth commented 2 years ago
hcaslan commented 2 years ago

i followed these steps Screenshot from 2021-10-26 20-53-26

And I got error after using this command. make -j16

Am I missing something?, I'm new to this.

mvieth commented 2 years ago

Can you try with -DCMAKE_BUILD_TYPE=Release instead of None (delete the build directory release and do all steps under 3) again)? Side note: 16 build jobs (-j16) might be too much (unless you have lots of RAM, then congrats :wink: ). If the build jobs use too much RAM your computer might freeze or the build process might crash

larshg commented 2 years ago

I think you are missing the compiled boost libraries. Try install the boos package used here: https://github.com/PointCloudLibrary/pcl/blob/master/.dev/docker/env/Dockerfile

Rerun cmake and try compile again.

This is only if boost-all only contain headers and the the respective build libraries. Its only a guess. Im not aware of the packages of boost.

mvieth commented 2 years ago

I think you are missing the compiled boost libraries. Try install the boos package used here: https://github.com/PointCloudLibrary/pcl/blob/master/.dev/docker/env/Dockerfile

Rerun cmake and try compile again.

This is only if boost-all only contain headers and the the respective build libraries. Its only a guess. Im not aware of the packages of boost.

libboost-all-dev also installs libboost-date-time-dev, libboost-filesystem-dev, libboost-iostreams-dev, and pretty much everything else from boost, so this shouldn't be a problem. I was able to reproduce this linking error in a docker, will investigate further

larshg commented 2 years ago

The pcl_openni_pcd_recorder is build on the ubuntu 20.10 CI?

mvieth commented 2 years ago

The pcl_openni_pcd_recorder is build on the ubuntu 20.10 CI?

Yes, it is built (successfully) on all Ubuntu CIs. My best guess is that it builds successfully there (and fails here) because of the different CMAKE_BUILD_TYPE, but I will be able to say more after testing in the docker

larshg commented 2 years ago

https://stackoverflow.com/questions/17477177/undefined-reference-to-boostgregoriangreg-monthas-short-string-const

Sounds a lot like a plausible error. We would have to add date-time explicitly to the linker.

mvieth commented 2 years ago

It fails if CMAKE_BUILD_TYPE is e.g. None or Debug, and succeeds if it is e.g. MinSizeRel. I didn't test RelWithDebInfo and Release, but would guess they succeed, too. Linking to Boost::date_time in io/CMakeLists.txt (like this) seems to solve the problem. I would open a pull request, unless you @larshg favour a different solution

larshg commented 2 years ago

It fails if CMAKE_BUILD_TYPE is e.g. None or Debug, and succeeds if it is e.g. MinSizeRel. I didn't test RelWithDebInfo and Release, but would guess they succeed, too. Linking to Boost::date_time in io/CMakeLists.txt (like this) seems to solve the problem. I would open a pull request, unless you @larshg favour a different solution

Looks great!

hcaslan commented 2 years ago

Can you try with -DCMAKE_BUILD_TYPE=Release instead of None (delete the build directory release and do all steps under 3) again)? Side note: 16 build jobs (-j16) might be too much (unless you have lots of RAM, then congrats 😉 ). If the build jobs use too much RAM your computer might freeze or the build process might crash

Yes my computer froze at 56% with -j16 but i learned my lesson :D and -DCMAKE_BUILD_TYPE=Release worked thanks!