Make px4_sitl gazebo FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-build

Hello dear community.
I have downloaded the latest PX4-Autopilot from here and followed this instructions to build PX4-Autopilot but I am still getting this error:

FAILED: CMakeFiles/gazebo_camera_manager_plugin.dir/src/gazebo_camera_manager_plugin.cpp.o 
/usr/bin/c++  -DLIBBULLET_VERSION=2.87 -DLIBBULLET_VERSION_GT_282 -Dgazebo_camera_manager_plugin_EXPORTS -isystem /usr/include/gazebo-9 -isystem /usr/include/bullet -isystem /usr/include/simbody -isystem /usr/include/sdformat-6.0 -isystem /usr/include/ignition/math4 -isystem /usr/include/OGRE -isystem /usr/include/OGRE/Terrain -isystem /usr/include/OGRE/Paging -isystem /usr/include/ignition/transport4 -isystem /usr/include/ignition/msgs1 -isystem /usr/include/ignition/common1 -isystem /usr/include/ignition/fuel_tools1 -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -I/home/diego/PX4-Autopilot/Tools/sitl_gazebo/include -I. -I/usr/include/eigen3 -I/usr/include/eigen3/eigen3 -I/usr/include/gazebo-9/gazebo/msgs -I/home/diego/PX4-Autopilot/mavlink/include -isystem /usr/include/opencv -I/home/diego/PX4-Autopilot/Tools/sitl_gazebo/external/OpticalFlow/include -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/uuid -isystem /usr/include/x86_64-linux-gnu -O2 -g -DNDEBUG -fPIC   -Wno-deprecated-declarations -Wno-address-of-packed-member -I/usr/include/uuid -I/usr/include/x86_64-linux-gnu -std=gnu++1z -MD -MT CMakeFiles/gazebo_camera_manager_plugin.dir/src/gazebo_camera_manager_plugin.cpp.o -MF CMakeFiles/gazebo_camera_manager_plugin.dir/src/gazebo_camera_manager_plugin.cpp.o.d -o CMakeFiles/gazebo_camera_manager_plugin.dir/src/gazebo_camera_manager_plugin.cpp.o -c /home/diego/PX4-Autopilot/Tools/sitl_gazebo/src/gazebo_camera_manager_plugin.cpp
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.
[51/130] Building CXX object CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o
ninja: build stopped: subcommand failed.
FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-build 
cd /home/diego/PX4-Autopilot/build/px4_sitl_default/build_gazebo && /usr/bin/cmake --build /home/diego/PX4-Autopilot/build/px4_sitl_default/build_gazebo -- -j 6
ninja: build stopped: subcommand failed.
Makefile:230: recipe for target 'px4_sitl' failed
make: *** [px4_sitl] Error 1

Please help to figure it out.
Ubuntu 18.04
Ros Melodic

EDIT:
I have found the solution.
It is because my swap memory was 2G and I was running out of memory.
I have deleted the swap file and create a new one with 6gb of space following the steps described in this post.