Error about gazebo sitl building

Hi,everybody.
I am using ubuntu18.04 to build the px4’code for gazebo’s sitl. However it encounters error.How to fix it?Thank you!

cc1plus: out of memory allocating 1048576 bytes after a total of 8019968 bytes
[34/86] Building CXX object CMakeFiles/LiftDragPlugin.dir/src/liftdrag_plugin/liftdrag_plugin.cpp.o
[35/86] Building CXX object CMakeFiles/gazebo_motor_model.dir/src/gazebo_motor_model.cpp.o
[36/86] Building CXX object CMakeFiles/gazebo_magnetometer_plugin.dir/src/gazebo_magnetometer_plugin.cpp.o
[37/86] Building CXX object CMakeFiles/gazebo_multirotor_base_plugin.dir/src/gazebo_multirotor_base_plugin.cpp.o
ninja: build stopped: subcommand failed.
ninja: build stopped: subcommand failed.
Makefile:200: recipe for target ‘px4_sitl’ failed
make: *** [px4_sitl] Error 1

Looks like you ran out of memory. Is this in a virtual machine? And if so, could you raise the available RAM?

Hi,Julian!
Thank you for your reply.But I don’t use virtual machine.I run it in ubuntu which is installed directly in my PC.So,how could I fix the problem? thank you!

Ok, in that case try building with less cores:

make px4_sitl gazebo -j1

ı have problem like this: and also ı tried this make px4_sitl gazebo -j1but ı m taking:
yusuf@yusuf-GE60-0NC-0ND:~/src/Firmware$ make px4_sitl gazebo_plane
[2/5] Performing build step for ‘sitl_gazebo’
[22/28] Building CXX object CMakeFiles…r/src/gazebo_usv_dynamics_plugin.cpp.o
FAILED: /usr/bin/c++ -DLIBBULLET_VERSION=2.83 -DLIBBULLET_VERSION_GT_282 -Dgazebo_usv_dynamics_plugin_EXPORTS -isystem /usr/include/gazebo-8 -isystem /usr/include/bullet -isystem /usr/include/simbody -isystem /usr/include/sdformat-5.3 -isystem /usr/include/ignition/math3 -isystem /usr/include/OGRE -isystem /usr/include/OGRE/Terrain -isystem /usr/include/OGRE/Paging -isystem /usr/include/ignition/transport3 -isystem /usr/include/uuid -isystem /usr/include/ignition/msgs0 -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+±64 -I/home/yusuf/src/Firmware/Tools/sitl_gazebo/include -I. -I/usr/include/eigen3 -I/usr/include/eigen3/eigen3 -I/usr/include/gazebo-8/gazebo/msgs -I/home/yusuf/src/Firmware/mavlink/include -isystem /opt/ros/kinetic/include/opencv-3.3.1-dev -isystem /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv -I/home/yusuf/src/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=c++11 -std=gnu++14 -MMD -MT CMakeFiles/gazebo_usv_dynamics_plugin.dir/src/gazebo_usv_dynamics_plugin.cpp.o -MF CMakeFiles/gazebo_usv_dynamics_plugin.dir/src/gazebo_usv_dynamics_plugin.cpp.o.d -o CMakeFiles/gazebo_usv_dynamics_plugin.dir/src/gazebo_usv_dynamics_plugin.cpp.o -c /home/yusuf/src/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp
/home/yusuf/src/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp: In member function ‘virtual void gazebo::UsvDynamicsPlugin::Update()’:
/home/yusuf/src/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp:251:29: error: missing template arguments before ‘xformV’
ignition::math::Matrix4 xformV(vq);
^
/home/yusuf/src/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp:285:15: error: ‘xformV’ was not declared in this scope
bpntW = xformV * bpnt;
^
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-address-of-packed-member’
[22/28] Building CXX object CMakeFiles…ir/src/gazebo_opticalflow_plugin.cpp.o
ninja: build stopped: subcommand failed.
[2/5] Generating …/…/logs
FAILED: cd /home/yusuf/src/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
Makefile:205: recipe for target ‘px4_sitl’ failed
make: *** [px4_sitl] Error 1
can you help me?

I have same wrong with you.Have you fixed it ?

@yalcinyusuf That is not the solution. The problem is that you are using a unsupported version of the ignition::math library. Your issue is unrelated to the initial issue posted in this thread

Yes ,I did now ;solved.You go to home/username/src/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp and open gazebo_usv_dynamics_plugin.cpp.Then go to 251.line and change this line ,like 253.line:

and save this substitution.And again write: ```
make px4_sitl gazebo or what do you want
That’s it

2 Likes

I got the same error, SOLVED. Thank you so much !!

1 Like