0
$\begingroup$

Rosanswers logo

ROS indigo, pcl-1.7

I try to use voxel grid filter with the line:

pcl::VoxelGridpcl::PCLPointCloud2 sor;

But it throws errors when linking the libraries like the following:

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libpcl_filters.so: undefined reference to `pcl::search::KdTree<pcl::PointXYZRGBNormal, pcl::KdTreeFLANN<pcl::PointXYZRGBNormal, flann::L2_Simple > >::KdTree(bool)'

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libpcl_filters.so: undefined reference to `pcl::PCLBasepcl::CPPFSignature::setIndices(unsigned long, unsigned long, unsigned long, unsigned long)'

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libpcl_filters.so: undefined reference to `pcl::search::KdTree<pcl::PointXYZ, pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple > >::KdTree(bool)'

When I don't use voxel grid filter, the program compiles without problems.

Can someone tell me why it might be?


Originally posted by lmartinez on ROS Answers with karma: 11 on 2014-11-16

Post score: 1


Original comments

Comment by paulbovbel on 2014-11-23:
Please add your CMakeLists to your question.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

It might be late but could help someone with the same problem. The issue can be resolved by compiling /installing latest version of pcl from source. Additionally if your program uses pcl_conversion and pcl_ros packages that were installed from binaries then they will link against older version of pcl and again create dependency issue. You have to build these packages from source too to maintain version consistency. After it you wont have this error and program will compile fine.


Originally posted by ZainMehdi with karma: 225 on 2017-07-21

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by M@t on 2018-04-10:
How exactly did you go about installing pcl_conversions and pcl_ros from source?

Comment by ZainMehdi on 2018-04-10:
Just download the package in your workspace and build them.

Comment by M@t on 2018-04-11:
Yeap, not entirely sure how catkin/cmake knows to use the local version rather than the installed binaries, but I can confirm that using pcl_ros installed from source gets around the dependency issue I had with pcl_ros requiring PCL 1.7 (I'm now using PCL 1.8). Thanks for the help @ZainMehdi!

Comment by ia on 2021-03-01:
@ZainMehdi sorry I know this is an old post, but your suggestion works until I try to compile multiple ros packages from source that require PCL. Just one ros package is fine, but two or more and I get a very odd error. Any ideas?:

add_custom_target cannot create target "pcl_ros_gencfg" because another
  target with the same name already exists.  The existing target is a custom
  target created in source directory "/opt/ros_ws/src/other_ros_node_requiring_pcl".  See
  documentation for policy CMP0002 for more details.

I've created a new issue here: https://answers.ros.org/question/372984/compiling-pcl-from-source-for-multiple-ros-nodes/

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.