ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

PCL segmentation fault

asked 2020-08-14 11:54:18 -0500

yiying gravatar image

updated 2020-08-14 11:59:49 -0500

I am using ROS kinetic and I have PCL-1.9.1 installed on my computer. For the very same package, when compiled in different catkin workspaces, it performs differently.

To reproduce the error, you need a .pcd file and change the path and file name accordingly in the code.

At ~/catkin_ws

yiying@matebook-x:~/catkin_ws$ ./devel/lib/cylinder_segmentation/cylinder_segmentation 
Failed to find match for field 'rgb'.
PointCloud before filtering has: 20238 data points.
Cylinder coefficients: header: 
seq: 0 stamp: 0 frame_id: 
values[]
  values[0]:   -0.877246
  values[1]:   0.338439
  values[2]:   -0.217082
  values[3]:   0.885413
  values[4]:   -0.158791
  values[5]:   0.43684
  values[6]:   0.0644546

While at ~/fetchit_ws, it has segmentation fault

yiying@matebook-x:~/fetchit_ws$ gdb ./devel/lib/cylinder_segmentation/cylinder_segmentation 
GNU gdb (Ubuntu 8.2-0ubuntu1~16.04.1) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./devel/lib/cylinder_segmentation/cylinder_segmentation...(no debugging symbols found)...done.
(gdb) r
Starting program: /home/yiying/fetchit_ws/devel/lib/cylinder_segmentation/cylinder_segmentation 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
PointCloud before filtering has: 20238 data points.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5901fc0 in void Eigen::internal::call_assignment_no_alias<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::internal::assign_op<float> >(Eigen::Matrix<float, -1, -1, 0, -1, -1>&, Eigen::Matrix<float, -1, -1, 0, -1, -1> const&, Eigen::internal::assign_op<float> const&)
    () from /usr/local/lib/libpcl_features.so.1.9
(gdb) bt
#0  0x00007ffff5901fc0 in void Eigen::internal::call_assignment_no_alias<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::internal::assign_op<float> >(Eigen::Matrix<float, -1, -1, 0, -1, -1>&, Eigen::Matrix<float, -1, -1, 0, -1, -1> const&, Eigen::internal::assign_op<float> const&) () from /usr/local/lib/libpcl_features.so.1.9
#1  0x00007fffed1d3474 in Eigen::ColPivHouseholderQR<Eigen::Matrix<float, -1, -1, 0, -1, -1> >::ColPivHouseholderQR<Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::EigenBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&) ()
   from /usr/local/lib/libpcl_sample_consensus.so.1.9
#2  0x00007fffed375740 in Eigen::LevenbergMarquardt<Eigen::NumericalDiff<pcl::SampleConsensusModelCylinder<pcl::PointXYZRGB, pcl::Normal>::OptimizationFunctor, (Eigen::NumericalDiffMode)0>, float>::minimizeOneStep(Eigen::Matrix<float, -1, 1, 0, -1, 1>&) () from /usr/local/lib/libpcl_sample_consensus.so.1.9
#3  0x00007fffed3764ab in pcl::SampleConsensusModelCylinder<pcl::PointXYZRGB, pcl::Normal>::optimizeModelCoefficients(std::vector<int, std::allocator<int> > const&, Eigen::Matrix<float, -1, 1, 0, -1, 1> const&, Eigen::Matrix<float, -1, 1, 0, -1, 1>&) const () from /usr/local/lib ...
(more)
edit retag flag offensive close merge delete

Comments

@stevemacenski This is not PCL sepcific. Please reopen the question.

If compiled as C++ project, it runs without any problem. The problem I have is clearly ROS related.

yiying gravatar image yiying  ( 2020-08-14 21:45:09 -0500 )edit
1

It is, but it also isn't.

The most likely explanation is that you have multiple different versions of PCL, and the ROS binaries (ie: pcl_ros, pcl_conversions, etc) have been linked against one version, while you are trying to use a different version in your own nodes.

If your own nodes then also link against libraries from pcl_ros et al., just about the first thing you'll run into are SEGFAULTs.

You cannot link against two different versions of the same library. That cannot work.

You will have to make sure only a single version of PCL gets linked. Directly, as well as transitively.

And the reason I write it isn't a ROS problem is because this is not ROS specific. You just happen to run into it with PCL and a ROS node, but this is a general problem which has to do with how C++ binaries are constructed.

gvdhoorn gravatar image gvdhoorn  ( 2020-08-15 04:01:54 -0500 )edit

@gvdhoorn Thanks for your comment. You made a good point about two versions of PCL and linking issue. I do have PCL 1.9.1 installed and uses PCL 1.9.1, pcl_ros and pcl_conversions in my node.

What I don't understand is why one identical package (link given in description) will lead to two different results. The same error should appears no matter where the package is compiled, right? It doesn't. I suspect it has to do with how the catkin workspace is set up/configured, but looking at both config, I cannot see what it is that leads to the problem.

yiying gravatar image yiying  ( 2020-08-15 13:03:03 -0500 )edit

@gvdhoorn Care to answer my question?

yiying gravatar image yiying  ( 2020-08-23 17:25:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-07-14 13:14:10 -0500

Ruijie gravatar image

For those who are still curious about this problem, I have conducted research on it. In my project, I encountered a Segmentation Fault in PCL due to two specific CPP compile flags. However, after commenting out these flags, PCL works perfectly fine.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE -DEIGEN_MAX_ALIGN_BYTES=0")

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-08-14 11:54:18 -0500

Seen: 1,365 times

Last updated: Aug 14 '20