Open davidlavy88 opened 4 years ago
My bad. I tried with PCL 1.10 when compiling the library. But I tried to compile just the example using 1.9. Regarding the compiler flag issues, is there any way to fix it so it compiles just fine?
Please install PCL from source to get access to CUDA. Then use the installed source to compile example.
The distributed PCL might be missing library/header files/dependencies for CUDA which is showing up as compile errors (since pcl_isnan
is present in common module)
I did tried to compile from source as well, and I still get errors. I'm using PCL 1.10 this time. I modified this CMake file and added the example like so:
set(SUBSYS_NAME cuda_apps)
set(SUBSYS_DESC "Point cloud library CUDA apps")
set(SUBSYS_DEPS cuda_common cuda_io cuda_features cuda_segmentation cuda_sample_consensus common io visualization geometry)
# ---[ Point Cloud Library - pcl/cuda/apps
# Find VTK
if(NOT VTK_FOUND)
set(DEFAULT FALSE)
set(REASON "VTK was not found.")
else()
set(DEFAULT TRUE)
set(REASON)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
endif()
PCL_SUBSYS_OPTION(build "${SUBSYS_NAME}" "${SUBSYS_DESC}" ${DEFAULT} "${REASON}")
mark_as_advanced("BUILD_${SUBSYS_NAME}")
PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS})
if(NOT build)
return()
endif()
if(VTK_FOUND AND WITH_OPENNI)
PCL_CUDA_ADD_EXECUTABLE(kinect_viewer_cuda COMPONENT ${SUBSYS_NAME} SOURCES src/kinect_viewer_cuda.cpp)
target_link_libraries (kinect_viewer_cuda pcl_io pcl_cuda_io pcl_visualization pcl_common pcl_kdtree)
PCL_CUDA_ADD_EXECUTABLE(kinect_ransac COMPONENT ${SUBSYS_NAME} SOURCES src/kinect_ransac.cpp)
target_link_libraries (kinect_ransac pcl_io pcl_cuda_io pcl_cuda_sample_consensus pcl_visualization pcl_common pcl_kdtree)
endif()
I also had to modify the cpp file since it was using an incorrect namespace pcl_cuda
(it looks this file hasn't been updated). Once I made these corrections and compile, I get these errors:
Scanning dependencies of target kinect_ransac
[ 54%] Building CXX object cuda/apps/CMakeFiles/kinect_ransac.dir/src/kinect_ransac.cpp.o
[ 54%] Built target kinect_viewer_cuda
[ 54%] Building CXX object apps/point_cloud_editor/CMakeFiles/pcl_point_cloud_editor.dir/src/statisticsDialog.cpp.o
[ 54%] Built target pcl_outofcore
[ 55%] Building CXX object apps/point_cloud_editor/CMakeFiles/pcl_point_cloud_editor.dir/src/trackball.cpp.o
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp: In member function ‘void SimpleKinectTool::run(bool)’:
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:169:55: error: conflicting declaration ‘pcl::PCDGrabber<pcl::PointXYZRGB> filegrabber’
pcl::PCDGrabber<pcl::PointXYZRGB > filegrabber (path, frames_per_second, repeat);
^~~~
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:163:21: note: previous declaration as ‘pcl::Grabber* filegrabber’
pcl::Grabber* filegrabber = 0;
^~~~~~~~~~~
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:174:96: error: conversion from ‘std::_Bind_helper<false, void (SimpleKinectTool::*)(const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> >&), SimpleKinectTool*, const boost::arg<1>&>::type {aka std::_Bind<void (SimpleKinectTool::*(SimpleKinectTool*, boost::arg<1>))(const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> >&)>}’ to non-scalar type ‘std::function<void(const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> >&)>’ requested
std::function<void (const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&)> f = std::bind (&SimpleKinectTool::file_cloud_cb<pcl::cuda::Device>, this, _1);
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:175:21: error: request for member ‘registerCallback’ in ‘filegrabber’, which is of pointer type ‘pcl::Grabber*’ (maybe you meant to use ‘->’ ?)
filegrabber.registerCallback (f);
^~~~~~~~~~~~~~~~
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:180:96: error: conversion from ‘std::_Bind_helper<false, void (SimpleKinectTool::*)(const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> >&), SimpleKinectTool*, const boost::arg<1>&>::type {aka std::_Bind<void (SimpleKinectTool::*(SimpleKinectTool*, boost::arg<1>))(const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> >&)>}’ to non-scalar type ‘std::function<void(const boost::shared_ptr<const pcl::PointCloud<pcl::PointXYZRGB> >&)>’ requested
std::function<void (const pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr&)> f = std::bind (&SimpleKinectTool::file_cloud_cb<pcl::cuda::Host>, this, _1);
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:181:21: error: request for member ‘registerCallback’ in ‘filegrabber’, which is of pointer type ‘pcl::Grabber*’ (maybe you meant to use ‘->’ ?)
filegrabber.registerCallback (f);
^~~~~~~~~~~~~~~~
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:184:19: error: request for member ‘start’ in ‘filegrabber’, which is of pointer type ‘pcl::Grabber*’ (maybe you meant to use ‘->’ ?)
filegrabber.start ();
^~~~~
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:189:19: error: request for member ‘stop’ in ‘filegrabber’, which is of pointer type ‘pcl::Grabber*’ (maybe you meant to use ‘->’ ?)
filegrabber.stop ();
^~~~
[ 55%] Building CXX object apps/point_cloud_editor/CMakeFiles/pcl_point_cloud_editor.dir/src/denoiseParameterForm.cpp.o
Scanning dependencies of target pcl_example_extract_indices
[ 55%] Building CXX object examples/filters/CMakeFiles/pcl_example_extract_indices.dir/example_extract_indices.cpp.o
Scanning dependencies of target pcl_example_remove_nan_from_point_cloud
[ 55%] Building CXX object examples/filters/CMakeFiles/pcl_example_remove_nan_from_point_cloud.dir/example_remove_nan_from_point_cloud.cpp.o
Scanning dependencies of target pcl_example_outofcore
[ 55%] Building CXX object examples/outofcore/CMakeFiles/pcl_example_outofcore.dir/example_outofcore.cpp.o
Scanning dependencies of target pcl_example_outofcore_with_lod
[ 55%] Building CXX object examples/outofcore/CMakeFiles/pcl_example_outofcore_with_lod.dir/example_outofcore_with_lod.cpp.o
[ 55%] Building CXX object apps/point_cloud_editor/CMakeFiles/pcl_point_cloud_editor.dir/qrc_pceditor_resources.cpp.o
[ 55%] Building CXX object apps/point_cloud_editor/CMakeFiles/pcl_point_cloud_editor.dir/include/pcl/apps/point_cloud_editor/moc_cloudEditorWidget.cpp.o
In file included from /opt/cuda/include/thrust/detail/reference.h:173:0,
from /opt/cuda/include/thrust/memory.h:25,
from /opt/cuda/include/thrust/detail/allocator/temporary_allocator.h:23,
from /opt/cuda/include/thrust/detail/temporary_array.h:40,
from /opt/cuda/include/thrust/system/cuda/detail/internal/copy_cross_system.h:41,
from /opt/cuda/include/thrust/system/cuda/detail/copy.h:99,
from /opt/cuda/include/thrust/system/detail/adl/copy.h:42,
from /opt/cuda/include/thrust/detail/copy.inl:22,
from /opt/cuda/include/thrust/detail/copy.h:90,
from /opt/cuda/include/thrust/detail/allocator/copy_construct_range.inl:21,
from /opt/cuda/include/thrust/detail/allocator/copy_construct_range.h:46,
from /opt/cuda/include/thrust/detail/contiguous_storage.inl:22,
from /opt/cuda/include/thrust/detail/contiguous_storage.h:161,
from /opt/cuda/include/thrust/detail/vector_base.h:29,
from /opt/cuda/include/thrust/host_vector.h:26,
from /home/Lavy.David/Libraries/pcl/cuda/common/include/pcl/cuda/thrust.h:42,
from /home/Lavy.David/Libraries/pcl/cuda/common/include/pcl/cuda/point_cloud.h:41,
from /home/Lavy.David/Libraries/pcl/cuda/io/include/pcl/cuda/io/cloud_to_pcl.h:40,
from /home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:40:
/opt/cuda/include/thrust/detail/reference.inl: In instantiation of ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::strip_const_get_value(const System&) const [with System = thrust::cuda_cub::tag; Element = int; Pointer = thrust::device_ptr<int>; Derived = thrust::device_reference<int>; thrust::reference<Element, Pointer, Derived>::value_type = int]’:
/opt/cuda/include/thrust/detail/reference.inl:105:31: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::convert_to_value_type(System*) const [with System = thrust::cuda_cub::tag; Element = int; Pointer = thrust::device_ptr<int>; Derived = thrust::device_reference<int>; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/opt/cuda/include/thrust/detail/reference.inl:122:31: required from ‘thrust::reference<Element, Pointer, Derived>::operator thrust::reference<Element, Pointer, Derived>::value_type() const [with Element = int; Pointer = thrust::device_ptr<int>; Derived = thrust::device_reference<int>; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/home/Lavy.David/Libraries/pcl/cuda/sample_consensus/include/pcl/cuda/sample_consensus/sac_model.h:171:38: required from ‘bool pcl::cuda::SampleConsensusModel<Storage>::isSampleInlier(pcl::cuda::SampleConsensusModel<Storage>::IndicesPtr&, pcl::cuda::SampleConsensusModel<Storage>::Samples&, unsigned int&) [with Storage = pcl::cuda::Device; pcl::cuda::SampleConsensusModel<Storage>::IndicesPtr = boost::shared_ptr<thrust::device_vector<int, thrust::device_malloc_allocator<int> > >; typename Storage<int>::type = thrust::device_vector<int, thrust::device_malloc_allocator<int> >; pcl::cuda::SampleConsensusModel<Storage>::Samples = thrust::device_vector<int, thrust::device_malloc_allocator<int> >]’
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:236:1: required from here
/opt/cuda/include/thrust/detail/reference.inl:137:73: error: void value not ignored as it ought to be
return get_value(thrust::detail::derived_cast(non_const_system), m_ptr);
^
In file included from /opt/cuda/include/thrust/system/detail/generic/for_each.h:27:0,
from /opt/cuda/include/thrust/detail/for_each.inl:26,
from /opt/cuda/include/thrust/for_each.h:279,
from /opt/cuda/include/thrust/system/detail/generic/transform.inl:19,
from /opt/cuda/include/thrust/system/detail/generic/transform.h:105,
from /opt/cuda/include/thrust/detail/transform.inl:25,
from /opt/cuda/include/thrust/transform.h:724,
from /opt/cuda/include/thrust/system/detail/generic/copy.inl:23,
from /opt/cuda/include/thrust/system/detail/generic/copy.h:58,
from /opt/cuda/include/thrust/detail/copy.inl:21,
from /opt/cuda/include/thrust/detail/copy.h:90,
from /opt/cuda/include/thrust/detail/allocator/copy_construct_range.inl:21,
from /opt/cuda/include/thrust/detail/allocator/copy_construct_range.h:46,
from /opt/cuda/include/thrust/detail/contiguous_storage.inl:22,
from /opt/cuda/include/thrust/detail/contiguous_storage.h:161,
from /opt/cuda/include/thrust/detail/vector_base.h:29,
from /opt/cuda/include/thrust/host_vector.h:26,
from /home/Lavy.David/Libraries/pcl/cuda/common/include/pcl/cuda/thrust.h:42,
from /home/Lavy.David/Libraries/pcl/cuda/common/include/pcl/cuda/point_cloud.h:41,
from /home/Lavy.David/Libraries/pcl/cuda/io/include/pcl/cuda/io/cloud_to_pcl.h:40,
from /home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:40:
/opt/cuda/include/thrust/system/detail/generic/for_each.h: In instantiation of ‘void thrust::system::detail::generic::get_value(thrust::execution_policy<Derived>&, Pointer) [with DerivedPolicy = thrust::cuda_cub::tag; Pointer = thrust::device_ptr<int>]’:
/opt/cuda/include/thrust/detail/reference.inl:137:19: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::strip_const_get_value(const System&) const [with System = thrust::cuda_cub::tag; Element = int; Pointer = thrust::device_ptr<int>; Derived = thrust::device_reference<int>; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/opt/cuda/include/thrust/detail/reference.inl:105:31: required from ‘thrust::reference<Element, Pointer, Derived>::value_type thrust::reference<Element, Pointer, Derived>::convert_to_value_type(System*) const [with System = thrust::cuda_cub::tag; Element = int; Pointer = thrust::device_ptr<int>; Derived = thrust::device_reference<int>; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/opt/cuda/include/thrust/detail/reference.inl:122:31: required from ‘thrust::reference<Element, Pointer, Derived>::operator thrust::reference<Element, Pointer, Derived>::value_type() const [with Element = int; Pointer = thrust::device_ptr<int>; Derived = thrust::device_reference<int>; thrust::reference<Element, Pointer, Derived>::value_type = int]’
/home/Lavy.David/Libraries/pcl/cuda/sample_consensus/include/pcl/cuda/sample_consensus/sac_model.h:171:38: required from ‘bool pcl::cuda::SampleConsensusModel<Storage>::isSampleInlier(pcl::cuda::SampleConsensusModel<Storage>::IndicesPtr&, pcl::cuda::SampleConsensusModel<Storage>::Samples&, unsigned int&) [with Storage = pcl::cuda::Device; pcl::cuda::SampleConsensusModel<Storage>::IndicesPtr = boost::shared_ptr<thrust::device_vector<int, thrust::device_malloc_allocator<int> > >; typename Storage<int>::type = thrust::device_vector<int, thrust::device_malloc_allocator<int> >; pcl::cuda::SampleConsensusModel<Storage>::Samples = thrust::device_vector<int, thrust::device_malloc_allocator<int> >]’
/home/Lavy.David/Libraries/pcl/cuda/apps/src/kinect_ransac.cpp:236:1: required from here
/opt/cuda/include/thrust/detail/static_assert.h:71:13: error: invalid application of ‘sizeof’ to incomplete type ‘thrust::detail::STATIC_ASSERTION_FAILURE<false>’
sizeof(::thrust::detail::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
^
/opt/cuda/include/thrust/system/detail/generic/for_each.h:49:3: note: in expansion of macro ‘THRUST_STATIC_ASSERT’
THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<InputIterator, false>::value) );
^~~~~~~~~~~~~~~~~~~~
cuda/apps/CMakeFiles/kinect_ransac.dir/build.make:62: recipe for target 'cuda/apps/CMakeFiles/kinect_ransac.dir/src/kinect_ransac.cpp.o' failed
make[2]: *** [cuda/apps/CMakeFiles/kinect_ransac.dir/src/kinect_ransac.cpp.o] Error 1
CMakeFiles/Makefile2:4583: recipe for target 'cuda/apps/CMakeFiles/kinect_ransac.dir/all' failed
make[1]: *** [cuda/apps/CMakeFiles/kinect_ransac.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
The first set of errors seems to be due to a double definition of the variable filegrabber
and the second is related the thrust
library.
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.
any update on this error, I also facing same error.
@pravin25
I am using following configuration
I was trying to compile cuda/apps/ kinect_planescuda.cpp following error was coming. "/opt/cuda/include/thrust/detail/reference.inl:137:73: error: void value not ignored as it ought to be return get_value(thrust::detail::derived_cast(non_const_system), mptr);"
after did the following changes I am able to compile.
Your Environment
Context
Expected Behavior
Current Behavior
I'm trying to compile one of the cuda examples that uses RANSAC, but I can't find a way to compile it. I created my own CMake file:
Code to Reproduce
When I try to build the example I get the following errors:
I have also noticed that PCL doesn't build this app when compiling the library. I tried to add the example to their CMake but I find similar errors too.
Possible Solution
I don't have a clear idea on how to make this work. I don't know much about CMake and adding CUDA makes it a bit harder as well.