PointCloudLibrary / PointCloudLibrary/pcl

Can't compile kinect_ransac.cpp with PCL

Open
#3,640 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind: compile error kind: todo module: cuda
Dominant language
C++
Stars
11.1k
Forks
4.7k
Avg merge
4d 10h
Merged PRs (30d)
6

Description

Your Environment

  • Operating System and version: Ubunt u 18.04
  • Compiler: nvcc, g++
  • PCL Version: 1.9

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:

cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(ransac_gpu LANGUAGES CXX CUDA)
find_package(PCL 1.9 REQUIRED)
find_package(CUDA)

include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

find_library(CUDART_LIB cudart HINTS /usr/local/cuda/lib64)

CUDA_ADD_EXECUTABLE(kinect_ransac kinect_ransac.cpp)

target_include_directories(kinect_ransac PRIVATE "/usr/local/cuda/include/")
target_link_libraries (kinect_ransac
  ${Boost_LIBRARIES}
    ${PCL_LIBRARIES}
    ${CUDART_LIB})

Code to Reproduce

When I try to build the example I get the following errors:

$ make -j12
Scanning dependencies of target kinect_ransac
[ 50%] Building CXX object CMakeFiles/kinect_ransac.dir/kinect_ransac.cpp.o
In file included from /usr/local/include/pcl-1.9/pcl/cuda/sample_consensus/sac_model_1point_plane.h:43:0,
                 from /home/Lavy.David/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:44:
/usr/local/include/pcl-1.9/pcl/cuda/sample_consensus/sac_model.h: In member function ‘bool pcl::cuda::isNaNPoint::operator()(pcl::cuda::PointXYZRGB)’:
/usr/local/include/pcl-1.9/pcl/cuda/sample_consensus/sac_model.h:79:21: error: ‘pcl_isnan’ was not declared in this scope
             return (pcl_isnan (pt.x) | pcl_isnan (pt.y) | pcl_isnan (pt.z)) == 1;
                     ^~~~~~~~~
/usr/local/include/pcl-1.9/pcl/cuda/sample_consensus/sac_model.h:79:21: note: suggested alternative: ‘__isnan’
             return (pcl_isnan (pt.x) | pcl_isnan (pt.y) | pcl_isnan (pt.z)) == 1;
                     ^~~~~~~~~
                     __isnan
/home/Lavy.David/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp: In member function ‘void SimpleKinectTool::run(bool)’:
/home/Lavy.David/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:168:55: error: conflicting declaration ‘pcl::PCDGrabber<pcl::PointXYZRGB> filegrabber’
       pcl::PCDGrabber<pcl::PointXYZRGB > filegrabber (path, frames_per_second, repeat);
                                                       ^~~~
/home/Lavy.David/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:162:21: note: previous declaration as ‘pcl::Grabber* filegrabber’
       pcl::Grabber* filegrabber = 0;
                     ^~~~~~~~~~~
/home/Lavy.David/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:173: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/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:174: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/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:179: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/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:180: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/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:183: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/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:188:19: error: request for member ‘stop’ in ‘filegrabber’, which is of pointer type ‘pcl::Grabber*’ (maybe you meant to use ‘->’ ?)
       filegrabber.stop ();
                   ^~~~
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 /usr/local/include/pcl-1.9/pcl/cuda/thrust.h:43,
                 from /usr/local/include/pcl-1.9/pcl/cuda/point_cloud.h:42,
                 from /usr/local/include/pcl-1.9/pcl/cuda/io/cloud_to_pcl.h:41,
                 from /home/Lavy.David/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/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]’
/usr/local/include/pcl-1.9/pcl/cuda/sample_consensus/sac_model.h:172: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/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:235: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 /usr/local/include/pcl-1.9/pcl/cuda/thrust.h:43,
                 from /usr/local/include/pcl-1.9/pcl/cuda/point_cloud.h:42,
                 from /usr/local/include/pcl-1.9/pcl/cuda/io/cloud_to_pcl.h:41,
                 from /home/Lavy.David/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/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]’
/usr/local/include/pcl-1.9/pcl/cuda/sample_consensus/sac_model.h:172: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/Projects/sandbox/learningCUDA/my_tests/ransac_gpu/kinect_ransac.cpp:235:1:   required from here
/opt/cuda/include/thrust/system/detail/generic/for_each.h:49:3: error: invalid application of ‘sizeof’ to incomplete type ‘thrust::detail::STATIC_ASSERTION_FAILURE<false>’
   THRUST_STATIC_ASSERT( (thrust::detail::depend_on_instantiation<InputIterator, false>::value) );
   ^
CMakeFiles/kinect_ransac.dir/build.make:62: recipe for target 'CMakeFiles/kinect_ransac.dir/kinect_ransac.cpp.o' failed
make[2]: *** [CMakeFiles/kinect_ransac.dir/kinect_ransac.cpp.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/kinect_ransac.dir/all' failed
make[1]: *** [CMakeFiles/kinect_ransac.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported CMake configuration and the kinect_ransac.cpp build on Ubuntu 18.04 using PCL 1.9, nvcc, and g++. Read the referenced PCL CUDA headers alongside the compiler output, separating the example's errors from dependency or toolchain failures. Done means establishing a reproducible supported build or documenting the specific incompatibilities and required corrections.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.