虚拟机 ubuntu 1804 编译tb3_ros2包时,报错c++: internal compiler error: Killed (program cc1plus)

错误提示:
 
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
make[2]: *** [CMakeFiles/cartographer_ros.dir/cartographer_ros/node.cc.o] Error 4
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/cartographer_ros.dir/all] Error 2
make: *** [all] Error 2
---
Failed <<< cartographer_ros [ Exited with code 2 ]

Summary: 11 packages finished [1min 16s]
1 package failed: cartographer_ros
1 package had stderr output: cartographer_ros
2 packages not processed
已邀请:

lalala

赞同来自:

解决方法:
 
出现该错误的主要原因是内存不足
在编译时,使用 free -h 命令查看实时内存的使用情况
 
ubuntu@ubuntu:~$ free -h
total used free shared buff/cache available
Mem: 3.8G 2.8G 576M 4.8M 451M 788M
Swap: 1.4G 6.8M 1.4G

可以看到编译时使用的内存已经超过2G,而本来虚拟机设置的内存是2G,调整到4G后,编译成功
 
参考资料:
 
https://bitcointalk.org/index.php?topic=304389.0
 
 
 

要回复问题请先登录注册