ROS Hector Mapping: c++: internal compiler error: Segmentation fault (program cc1plus)

I have this error when compiling a ROS package called Hector Mapping. I used to have this error when I was trying to a PCL package and figured out the header file caused the issue, which was pcl_transforms.h. However, I can’t find the header caused the fault this time. On my laptop (x86), it compiles without any problem. Do you know what the reason is? I am using gcc and g++ 7.5.0.

c++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-7/README.Bugs for instructions.
ros_ws/hector_slam/hector_mapping/CMakeFiles/hector_mapping.dir/build.make:62: recipe for target ‘corridor_navigation/hector_slam/hector_mapping/CMakeFiles/hector_mapping.dir/src/HectorMappingRos.cpp.o’ failed
make[2]: *** [ros_ws/hector_slam/hector_mapping/CMakeFiles/hector_mapping.dir/src/HectorMappingRos.cpp.o] Error 4
CMakeFiles/Makefile2:1108: recipe for target ‘ros_ws/hector_slam/hector_mapping/CMakeFiles/hector_mapping.dir/all’ failed
make[1]: *** [ros_ws/hector_slam/hector_mapping/CMakeFiles/hector_mapping.dir/all] Error 2
Makefile:140: recipe for target ‘all’ failed
make: *** [all] Error 2

Hi @asagllam, sorry I’m unfamiliar with this ROS package, but maybe others from the community are able to share their experience.

Generally internal compiler errors (ICE) are an indication that a newer version of the compiler needs to be used to build the code. Or if you received a killed message that the board has run out of memory during compilation and that you should try mounting swap memory.

I met the similar problem when compiling pcl1.9. I solved this problem through below way:
1.Increase the user process’s stack size
ulimit -s 10240
ulimit -s unlimited
2.Increase the swap size
dd if=/dev/zero of=/swapfile1 bs=64M count=64
mkswap /swapfile1
swapon /swapfile1

make -j 4

1 Like

Thanks for the suggestions but I have already tried mounting & increasing size of swap memory. I have also tried various compilers both older and newer versions but nothing helped. I came across this issue when compiling another ROS package, SLAM Toolbox, as well. I was able to fix it by changing the compile option from RELEASE to DEBUG. It didn’t work for Hector Mapping package, though.

Thank you very much. Increasing the stack size with make -j 4 (I did not change swap size as I already had 4GB) worked for both compiling the pcl_transform and Hector slam package.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.