Search code examples
c++boostcudapoint-cloud-librarypcl

Strange errors of compiling pcl1.8 with cuda 11.3


System: cuda 11.3, gcc 7.5, boost 1.65.1, pcl 1.8.0

When I compile code that uses PCL library, it shows the following error

/usr/include/pcl-1.8/pcl/io/file_io.h(264): error: namespace "boost" has no member "numeric_cast"

/usr/include/pcl-1.8/pcl/io/file_io.h(264): error: type name is not allowed

/usr/include/pcl-1.8/pcl/io/file_io.h(280): error: namespace "boost" has no member "numeric_cast"

/usr/include/pcl-1.8/pcl/io/file_io.h(280): error: type name is not allowed

/usr/include/pcl-1.8/pcl/io/file_io.h(346): error: namespace "boost" has no member "iequals"

/usr/include/pcl-1.8/pcl/io/file_io.h(372): error: namespace "boost" has no member "iequals"

/usr/include/pcl-1.8/pcl/io/pcd_io.h(485): error: name followed by "::" must be a class or namespace name

/usr/include/pcl-1.8/pcl/io/pcd_io.h(493): error: name followed by "::" must be a class or namespace name

I looked into the file_io.h, found that the related code is <pcl/io/boost.h>. In this file, the header <boost/numeric/conversion/cast.hpp> contains the numeria_cast function, obviously this header is not included. Is this error related to the macro __CUDACC__? How do I solve this issue? /usr/include/pcl-1.8/pcl/io/boost.h is:

#ifndef _PCL_IO_BOOST_H_
#define _PCL_IO_BOOST_H_

#if defined __GNUC__
#  pragma GCC system_header
#endif
#ifndef __CUDACC__
//https://bugreports.qt-project.org/browse/QTBUG-22829
#ifndef Q_MOC_RUN
#include <boost/version.hpp>
#include <boost/numeric/conversion/cast.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread.hpp>
#include <boost/thread/thread.hpp>
#include <boost/filesystem.hpp>
#include <boost/bind.hpp>
#include <boost/cstdint.hpp>
#include <boost/function.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/mpl/fold.hpp>
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/inherit_linearly.hpp>
#include <boost/mpl/joint_view.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/algorithm/string.hpp>
#ifndef Q_MOC_RUN
#include <boost/date_time/posix_time/posix_time.hpp>
#endif
#if BOOST_VERSION >= 104700
#include <boost/chrono.hpp>
#endif
#include <boost/tokenizer.hpp>
#include <boost/foreach.hpp>
#include <boost/shared_array.hpp>
#include <boost/interprocess/sync/file_lock.hpp>
#if BOOST_VERSION >= 104900
#include <boost/interprocess/permissions.hpp>
#endif
#include <boost/iostreams/device/mapped_file.hpp>
#define BOOST_PARAMETER_MAX_ARITY 7
#include <boost/signals2.hpp>
#include <boost/signals2/slot.hpp>
#endif
#endif
#endif    // _PCL_IO_BOOST_H_

Solution

  • Right, I solved it by using normal gcc compiler... DONT USE NVCC!