Ask Your Question

moveit segfaults due to eigen

asked 2019-03-01 12:16:36 -0600

negril gravatar image

I am running ros melodic on an up to date unstable x86_64 gentoo with ebuilds from the ros-overlay. As far as I am aware the last update of the ebuilds was three days ago. I tested with moveit-0.10.0 as well as the recently released moveit-1.0.0.

So far I have tested gcc-7.3.0, gcc-7.4.0, gcc-8.2.0 and gcc-8.3.0 with binutils-2.31.1 and -2.32 with the same results.

I have tested eigen 3.3.4, 3.3.5 and 3.3.7 against gcc-8.3.0, binutils-2.32 and moveit-1.0.0 with the same results.

Either rviz or move_group will crash somewhere in moveit code with segfaults cause by eigen. I have attached a few crash reports with similar failures.

After reading "Eigen Memory Issues" and "Explanation of the assertion on unaligned arrays" I am aware eigen related segfaults can be caused by mismatched build flags which might be an issue on gentoo. All ros related packages are build with "-O2 -pipe -march=native -mtune=native -Wall -g -ggdb". I also created a local catkin workspace where I rebuild industrial_core, motoman, moveit, moveit_visual_tools and rviz with the same build flags and both -std=c++11 and -std=c++14 with no change in outcome.

I used to be able to run the same commands i tested with eigen-3.2.8 and moveit-0.10.0 but since moveit-1.0.0 requires eigen-3.3 and eigen-3.2 has been deprecated in gentoo I am reluctant to downgrade back to that. Blender and meshlab which also depend on eigen do run without segfaults.

Since I am not fully certain if this is a build system error or an error in moveit I haven't filled an issue on github yet.

When i compile moveit_core with "-Wall" set I get this suspicious warning:

/var/tmp/portage/ros-melodic-moveit_core-1.0.0/work/moveit_core-1.0.0/robot_state/src/robot_state.cpp: In member function 'void moveit::core::RobotState::copyFrom(const moveit::core::RobotState&)':
/var/tmp/portage/ros-melodic-moveit_core-1.0.0/work/moveit_core-1.0.0/robot_state/src/robot_state.cpp:161:79: warning: 'void* memcpy(void*, const void*, size_t)' writing to an object of type 'Eigen::Isometry3d' {aka 'class Eigen::Transform<double, 3, 1>'} with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
     memcpy(variable_joint_transforms_, other.variable_joint_transforms_, bytes);
In file included from /usr/include/eigen3/Eigen/Geometry:44,
                 from /var/tmp/portage/ros-melodic-moveit_core-1.0.0/work/moveit_core-1.0.0/robot_model/include/moveit/robot_model/joint_model.h:47,
                 from /var/tmp/portage/ros-melodic-moveit_core-1.0.0/work/moveit_core-1.0.0/robot_model/include/moveit/robot_model/joint_model_group.h:41,
                 from /var/tmp/portage/ros-melodic-moveit_core-1.0.0/work/moveit_core-1.0.0/robot_model/include/moveit/robot_model/robot_model.h:47,
                 from /var/tmp/portage/ros-melodic-moveit_core-1.0.0/work/moveit_core-1.0.0/robot_state/include/moveit/robot_state/robot_state.h:41,
                 from /var/tmp/portage/ros-melodic-moveit_core-1.0.0/work/moveit_core-1.0.0/robot_state/src/robot_state.cpp:38:
/usr/include/eigen3/Eigen/src/Geometry/Transform.h:201:7: note: 'Eigen::Isometry3d ...
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2019-03-06 10:33:23 -0600

negril gravatar image

The version that worked was moveit-0.10.8 and eigen-3.2.8.

Reading through the patch notes for eigen, they introduced AVX support with version 3.3. Which is enabled with -march=native on my system. AVX requires 32 bit-alignment whereas RobotState enforces 16 bit-alignment here resulting in segfaults.

When I add "-DEIGEN_MAX_ALIGN_BYTES=16 -DEIGEN_UNALIGNED_VECTORIZE=0" to the CXXFLAGS for moveit it will run without issues, as this will create SSE compatible code.

As this is a bug in moveit i will open an issue on github.

@rhaschke that warning was introduced in gcc-8:

edit flag offensive delete link more


Thanks for tracking this down. Looks like an easy fix.

rhaschke gravatar image rhaschke  ( 2019-03-06 10:40:35 -0600 )edit

I wouldn't say that it's an easy fix, as setting the flags is a stop gap solution. It doesn't stop the underlying problem with the hackish c code in there.

negril gravatar image negril  ( 2019-03-06 11:11:21 -0600 )edit

I didn't thought about using your quick fix. However, the proper fix is easy to realize as well: Could you please verify this and then approve on github?

rhaschke gravatar image rhaschke  ( 2019-03-06 14:39:56 -0600 )edit

answered 2019-03-05 14:42:25 -0600

mlautman gravatar image

This is likely a result of the effort to move from Affine3d to Isometry3d which was merged into melodic last November. @rhaschke or @v4hn could probably comment on this better than I. I would recommend opening an issue on github.

edit flag offensive delete link more

answered 2019-03-05 15:04:31 -0600

rhaschke gravatar image

updated 2019-03-05 15:49:42 -0600

If I understand you correctly:

  • moveit-0.10.0 and eigen-3.2.8 works
  • moveit-1.0.0 and eigen-3.3 triggers the compiler warning and segfaults

As we don't test against gentoo systems, could you please verify whether you have the same issue also with moveit-0.10.5 and eigen-3.3, which is before the Isometry3d transition.

I just confirmed that on Ubuntu Bionic with eigen-3.3.4 the compiler gcc-7.3.0 doesn't issue the mentioned warning.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-03-01 12:16:36 -0600

Seen: 334 times

Last updated: Mar 05 '19