(无人机)编译make px4_sitl_default gazebo 命令 遇到 c++: internal compiler error: 已杀死 (program cc1plus)错误

@[TOC](编译make px4_sitl_default gazebo 命令 遇到 c++: internal compiler error: 已杀死 (program cc1plus)错误)

具体错误如下:

[11/33] Building CXX object CMakeFiles...plugin.dir/src/gazebo_uuv_plugin.cpp.o
FAILED: /usr/bin/c++   -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -Dgazebo_uuv_plugin_EXPORTS -isystem /usr/include/qt4 -isystem /usr/include/qt4/QtGui -isystem /usr/include/qt4/QtCore -isystem /usr/include/gazebo-7 -isystem /usr/include/sdformat-4.4 -isystem /usr/include/ignition/math2 -isystem /usr/include/OGRE -I/home/weiweu/PX4_Firmware/Tools/sitl_gazebo/include -I. -I/usr/include/eigen3 -I/usr/include/eigen3/eigen3 -I/usr/include/gazebo-7/gazebo/msgs -I/home/weiweu/PX4_Firmware/mavlink/include -I/usr/include/OGRE/Paging -isystem /opt/ros/kinetic/include/opencv-3.3.1-dev -isystem /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv -I/home/weiweu/PX4_Firmware/Tools/sitl_gazebo/external/OpticalFlow/include -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wno-deprecated-declarations -Wno-address-of-packed-member -fPIC   -std=gnu++14 -MMD -MT CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o -MF CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o.d -o CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o -c /home/weiweu/PX4_Firmware/Tools/sitl_gazebo/src/gazebo_uuv_plugin.cpp
c++: internal compiler error: 已杀死 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
[11/33] Building CXX object CMakeFiles...dir/src/gazebo_mavlink_interface.cpp.o
ninja: build stopped: subcommand failed.
[2/5] Generating ../../logs
FAILED: cd /home/weiweu/PX4_Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
Makefile:198: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Error 1

解决办法:

这个原因是内存不足, 在linux下增加临时swap空间

#注释:of=/home/swap,放置swap的空间; count的大小就是增加的swap空间的大小,64M就是块大小,这里是64MB,所以总共空间就是bs*count=1024MB.这里分配空间的时候需要一点时间,等待执行完毕。
sudo dd if=/dev/zero of=/home/swap bs=64M count=16  

#注释:把刚才空间格式化成swap各式
sudo mkswap /home/swap (可能会提示warning: don't erase bootbits sectorson whole disk. Use -f to force,不用理会)


#注释:使刚才创建的swap空间
sudo swapon /home/swap

然后执行你的需要的make,我的是

make px4_sitl_default gazebo

便可以成功运行:
(无人机)编译make px4_sitl_default gazebo 命令 遇到 c++: internal compiler error: 已杀死 (program cc1plus)错误_第1张图片

你可能感兴趣的:(无人机学习及搭建,linux,makefile,无人机,嵌入式,ros)