SolvedPX4 Autopilot Error with make posix_sitl_default gazebo with gazebo7

I have been using gazebo6 with ROS indigo(on Ubuntu 14.04) to run the PX4 plugin and now changing to gazebo7 with ROS kinetic (on Ubuntu 16.04)

I have followed the instructions and the

make posix_sitl_default jmavsim

works just fine. However, I cannot make the plugin run with gazebo7.
Below is the error when I am trying to run the px4 plugin with

make posix_sitl_default gazebo

The document states that the SITL does not work in Gazebo7 but I see some posts that it does. (and the documentation is now mostly based on gazebo7)
I am not sure how I should understand the support for gazebo7.

PX4 CONFIG: /home/cosmonaut/src/Firmware/build_posix_sitl_default
Scanning dependencies of target sitl_gazebo
[  0%] Built target prebuild_targets
[  0%] Creating directories for 'sitl_gazebo'
[  0%] Built target git_gencpp
[  0%] Built target git_genmsg
[  0%] Built target git_mavlink
[  0%] Built target git_uavcan
[  1%] Built target git_matrix
[  1%] Built target git_jmavsim
[  1%] Built target git_driverframework
[  3%] Built target df_driver_framework
[  4%] No download step for 'sitl_gazebo'
[  5%] Built target git_gazebo
[  5%] Built target git_ecl
[  6%] Built target xml_gen
[  6%] Built target mixer_gen
[  6%] No patch step for 'sitl_gazebo'
[  6%] No update step for 'sitl_gazebo'
[  6%] Performing configure step for 'sitl_gazebo'
-- install-prefix: /usr
[ 26%] Built target msg_gen
[ 26%] Built target platforms__common
[ 26%] Built target generate_topic_listener
-- The C compiler identification is GNU 5.4.0
[ 26%] Built target drivers__boards__sitl
[ 28%] Built target drivers__device
[ 29%] Built target drivers__pwm_out_sim
[ 32%] Built target drivers__gps
[ 37%] Built target systemcmds__tests
[ 38%] Built target platforms__posix__drivers__adcsim
[ 38%] Built target platforms__posix__drivers__accelsim
[ 40%] Built target drivers__vmount
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
[ 40%] Built target platforms__posix__drivers__gpssim
[ 41%] Built target platforms__posix__drivers__barosim
[ 41%] Built target platforms__posix__drivers__airspeedsim
[ 41%] Built target platforms__posix__drivers__rgbledsim
[ 42%] Built target platforms__posix__drivers__ledsim
[ 42%] Built target platforms__posix__drivers__gyrosim
[ 43%] Built target platforms__posix__px4_layer
[ 44%] Built target platforms__posix__drivers__tonealrmsim
[ 47%] Built target platforms__posix__work_queue
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
[ 47%] Built target systemcmds__esc_calib
[ 47%] Built target systemcmds__mixer
[ 47%] Built target systemcmds__param
[ 48%] Built target systemcmds__perf
[ 48%] Built target systemcmds__reboot
[ 48%] Built target systemcmds__sd_bench
[ 49%] Built target systemcmds__topic_listener
[ 49%] Built target systemcmds__top
[ 49%] Built target systemcmds__ver
[ 50%] Built target systemcmds__motor_ramp
-- Detecting C compiler ABI info - done
[ 51%] Built target modules__attitude_estimator_q
[ 51%] Built target modules__dataman
[ 53%] Built target modules__commander
-- Detecting C compile features
[ 53%] Built target modules__ekf2
[ 53%] Built target lib__external_lgpl
[ 57%] Built target lib__ecl
[ 58%] Built target modules__land_detector
[ 60%] Built target modules__uORB
[ 61%] Built target modules__mc_pos_control
[ 61%] Built target modules__mc_att_control
[ 61%] Built target modules__param
[ 64%] Built target modules__mavlink
[ 68%] Built target modules__navigator
[ 68%] Built target modules__replay
[ 69%] Built target modules__position_estimator_inav
[ 71%] Built target modules__local_position_estimator
[ 72%] Built target modules__sdlog2
[ 73%] Built target modules__sensors
[ 74%] Built target modules__systemlib__mixer
[ 74%] Built target modules__simulator
[ 78%] Built target modules__systemlib
[ 79%] Built target lib__controllib
[ 80%] Built target modules__vtol_att_control
[ 80%] Built target lib__conversion
[ 81%] Built target lib__DriverFramework__framework
[ 82%] Built target lib__geo
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
[ 82%] Built target lib__geo_lookup
[ 83%] Built target lib__launchdetection
[ 84%] Built target lib__mathlib
[ 84%] Built target lib__mathlib__math__filter
[ 85%] Built target lib__rc
[ 85%] Built target lib__tailsitter_recovery
[ 86%] Built target lib__runway_takeoff
[ 87%] Built target lib__terrain_estimation
[ 88%] Built target examples__px4_simple_app
[ 89%] Built target examples__mc_att_control_multiplatform
[ 90%] Built target examples__mc_pos_control_multiplatform
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
[ 91%] Built target examples__ekf_att_pos_estimator
[ 92%] Built target examples__attitude_estimator_ekf
[ 92%] Built target examples__fixedwing_control
[ 92%] Built target drivers__sf0x__sf0x_tests
[ 92%] Built target lib__rc__rc_tests
[ 93%] Built target modules__commander__commander_tests
[ 93%] Built target modules__mc_pos_control__mc_pos_control_tests
[ 94%] Built target modules__controllib_test
[ 94%] Built target modules__unit_test
[ 95%] Built target modules__uORB__uORB_tests
[ 96%] Built target modules__fw_att_control
-- Detecting CXX compiler ABI info - done
[ 97%] Built target modules__fw_pos_control_l1
-- Detecting CXX compile features
[ 98%] Built target modules__logger
[ 99%] Built target px4
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   thread
--   signals
--   system
--   filesystem
--   program_options
--   regex
--   iostreams
--   date_time
--   chrono
--   atomic
-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so  
-- Boost version: 1.58.0
-- Looking for OGRE...
-- OGRE_PREFIX_WATCH changed.
-- Checking for module 'OGRE'
--   Found OGRE, version 1.9.0
-- Found Ogre Ghadamon (1.9.0)
-- Found OGRE: optimized;/usr/lib/x86_64-linux-gnu/libOgreMain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreMain.so
-- Looking for OGRE_Paging...
-- Found OGRE_Paging: optimized;/usr/lib/x86_64-linux-gnu/libOgrePaging.so;debug;/usr/lib/x86_64-linux-gnu/libOgrePaging.so
-- Looking for OGRE_Terrain...
-- Found OGRE_Terrain: optimized;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so;debug;/usr/lib/x86_64-linux-gnu/libOgreTerrain.so
-- Looking for OGRE_Property...
-- Found OGRE_Property: optimized;/usr/lib/x86_64-linux-gnu/libOgreProperty.so;debug;/usr/lib/x86_64-linux-gnu/libOgreProperty.so
-- Looking for OGRE_RTShaderSystem...
-- Found OGRE_RTShaderSystem: optimized;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so;debug;/usr/lib/x86_64-linux-gnu/libOgreRTShaderSystem.so
-- Looking for OGRE_Volume...
-- Found OGRE_Volume: optimized;/usr/lib/x86_64-linux-gnu/libOgreVolume.so;debug;/usr/lib/x86_64-linux-gnu/libOgreVolume.so
-- Looking for OGRE_Overlay...
-- Found OGRE_Overlay: optimized;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so;debug;/usr/lib/x86_64-linux-gnu/libOgreOverlay.so
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   thread
--   timer
--   chrono
--   date_time
--   atomic
-- catkin DISABLED
-- Checking for module 'protobuf'
--   Found protobuf, version 2.6.1
Gazebo version: 7.4
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   thread
--   timer
--   chrono
--   date_time
--   atomic
-- Configuring done
-- Generating done
-- Build files have been written to: /home/cosmonaut/src/Firmware/build_posix_sitl_default/build_gazebo
[100%] Performing build step for 'sitl_gazebo'
Scanning dependencies of target sdf
[  2%] Running C++ protocol buffer compiler on msgs/MotorSpeed.proto
[  5%] Running C++ protocol buffer compiler on msgs/Float.proto
[  8%] Running C++ protocol buffer compiler on msgs/SensorImu.proto
[ 11%] Generating /home/cosmonaut/src/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf
[ 17%] Running C++ protocol buffer compiler on msgs/lidar.proto
[ 17%] Running C++ protocol buffer compiler on msgs/opticalFlow.proto
[ 20%] Running C++ protocol buffer compiler on msgs/CommandMotorSpeed.proto
Scanning dependencies of target mav_msgs
[ 22%] Building CXX object CMakeFiles/mav_msgs.dir/opticalFlow.pb.cc.o
[ 25%] Building CXX object CMakeFiles/mav_msgs.dir/Float.pb.cc.o
[ 28%] Building CXX object CMakeFiles/mav_msgs.dir/SensorImu.pb.cc.o

[ 28%] Built target sdf
[ 31%] Building CXX object CMakeFiles/mav_msgs.dir/lidar.pb.cc.o
[ 34%] Building CXX object CMakeFiles/mav_msgs.dir/CommandMotorSpeed.pb.cc.o
[ 37%] Building CXX object CMakeFiles/mav_msgs.dir/MotorSpeed.pb.cc.o
[ 40%] Linking CXX shared library libmav_msgs.so
[ 40%] Built target mav_msgs
Scanning dependencies of target rotors_gazebo_controller_interface
Scanning dependencies of target rotors_gazebo_mavlink_interface
Scanning dependencies of target LiftDragPlugin
Scanning dependencies of target rotors_gazebo_gimbal_controller_plugin
[ 42%] Building CXX object CMakeFiles/LiftDragPlugin.dir/src/liftdrag_plugin/liftdrag_plugin.cpp.o
[ 45%] Building CXX object CMakeFiles/rotors_gazebo_gimbal_controller_plugin.dir/src/gazebo_gimbal_controller_plugin.cpp.o
[ 51%] Building CXX object CMakeFiles/rotors_gazebo_mavlink_interface.dir/src/gazebo_mavlink_interface.cpp.o
[ 51%] Building CXX object CMakeFiles/rotors_gazebo_controller_interface.dir/src/gazebo_controller_interface.cpp.o
In file included from /usr/include/gazebo-7/gazebo/physics/Entity.hh:30:0,
                 from /usr/include/gazebo-7/gazebo/physics/Model.hh:34,
                 from /usr/include/gazebo-7/gazebo/physics/Actor.hh:24,
                 from /usr/include/gazebo-7/gazebo/physics/physics.hh:2,
                 from /home/cosmonaut/src/Firmware/Tools/sitl_gazebo/src/liftdrag_plugin/liftdrag_plugin.cpp:22:
/usr/include/gazebo-7/gazebo/msgs/msgs.hh:24:37: fatal error: ignition/math/Inertial.hh: No such file or directory
compilation terminated.
CMakeFiles/LiftDragPlugin.dir/build.make:62: recipe for target 'CMakeFiles/LiftDragPlugin.dir/src/liftdrag_plugin/liftdrag_plugin.cpp.o' failed
make[7]: *** [CMakeFiles/LiftDragPlugin.dir/src/liftdrag_plugin/liftdrag_plugin.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/LiftDragPlugin.dir/all' failed
make[6]: *** [CMakeFiles/LiftDragPlugin.dir/all] Error 2
make[6]: *** Waiting for unfinished jobs....
In file included from /usr/include/gazebo-7/gazebo/physics/Entity.hh:30:0,
                 from /usr/include/gazebo-7/gazebo/physics/Model.hh:34,
                 from /usr/include/gazebo-7/gazebo/physics/Actor.hh:24,
                 from /usr/include/gazebo-7/gazebo/physics/physics.hh:2,
                 from /home/cosmonaut/src/Firmware/Tools/sitl_gazebo/src/gazebo_gimbal_controller_plugin.cpp:18:
/usr/include/gazebo-7/gazebo/msgs/msgs.hh:24:37: fatal error: ignition/math/Inertial.hh: No such file or directory
compilation terminated.
[ 54%] Building CXX object CMakeFiles/rotors_gazebo_mavlink_interface.dir/src/geo_mag_declination.cpp.o
CMakeFiles/rotors_gazebo_gimbal_controller_plugin.dir/build.make:62: recipe for target 'CMakeFiles/rotors_gazebo_gimbal_controller_plugin.dir/src/gazebo_gimbal_controller_plugin.cpp.o' failed
make[7]: *** [CMakeFiles/rotors_gazebo_gimbal_controller_plugin.dir/src/gazebo_gimbal_controller_plugin.cpp.o] Error 1
CMakeFiles/Makefile2:178: recipe for target 'CMakeFiles/rotors_gazebo_gimbal_controller_plugin.dir/all' failed
make[6]: *** [CMakeFiles/rotors_gazebo_gimbal_controller_plugin.dir/all] Error 2
In file included from /usr/include/gazebo-7/gazebo/gazebo_core.hh:21:0,
                 from /usr/include/gazebo-7/gazebo/gazebo.hh:20,
                 from /home/cosmonaut/src/Firmware/Tools/sitl_gazebo/include/gazebo_mavlink_interface.h:25,
                 from /home/cosmonaut/src/Firmware/Tools/sitl_gazebo/src/gazebo_mavlink_interface.cpp:22:
/usr/include/gazebo-7/gazebo/msgs/msgs.hh:24:37: fatal error: ignition/math/Inertial.hh: No such file or directory
compilation terminated.
In file included from /usr/include/gazebo-7/gazebo/gazebo_core.hh:21:0,
                 from /usr/include/gazebo-7/gazebo/gazebo.hh:20,
                 from /home/cosmonaut/src/Firmware/Tools/sitl_gazebo/include/gazebo_controller_interface.h:26,
                 from /home/cosmonaut/src/Firmware/Tools/sitl_gazebo/src/gazebo_controller_interface.cpp:22:
/usr/include/gazebo-7/gazebo/msgs/msgs.hh:24:37: fatal error: ignition/math/Inertial.hh: No such file or directory
compilation terminated.
CMakeFiles/rotors_gazebo_mavlink_interface.dir/build.make:62: recipe for target 'CMakeFiles/rotors_gazebo_mavlink_interface.dir/src/gazebo_mavlink_interface.cpp.o' failed
CMakeFiles/rotors_gazebo_controller_interface.dir/build.make:62: recipe for target 'CMakeFiles/rotors_gazebo_controller_interface.dir/src/gazebo_controller_interface.cpp.o' failed
make[7]: *** [CMakeFiles/rotors_gazebo_mavlink_interface.dir/src/gazebo_mavlink_interface.cpp.o] Error 1
make[7]: *** [CMakeFiles/rotors_gazebo_controller_interface.dir/src/gazebo_controller_interface.cpp.o] Error 1
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/rotors_gazebo_controller_interface.dir/all' failed
make[6]: *** [CMakeFiles/rotors_gazebo_controller_interface.dir/all] Error 2
CMakeFiles/Makefile2:141: recipe for target 'CMakeFiles/rotors_gazebo_mavlink_interface.dir/all' failed
make[6]: *** [CMakeFiles/rotors_gazebo_mavlink_interface.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make[5]: *** [all] Error 2
src/firmware/posix/CMakeFiles/sitl_gazebo.dir/build.make:110: recipe for target 'external/Stamp/sitl_gazebo/sitl_gazebo-build' failed
make[4]: *** [external/Stamp/sitl_gazebo/sitl_gazebo-build] Error 2
CMakeFiles/Makefile2:9137: recipe for target 'src/firmware/posix/CMakeFiles/sitl_gazebo.dir/all' failed
make[3]: *** [src/firmware/posix/CMakeFiles/sitl_gazebo.dir/all] Error 2
CMakeFiles/Makefile2:10011: recipe for target 'src/firmware/posix/CMakeFiles/gazebo.dir/rule' failed
make[2]: *** [src/firmware/posix/CMakeFiles/gazebo.dir/rule] Error 2
Makefile:3510: recipe for target 'gazebo' failed
make[1]: *** [gazebo] Error 2
Makefile:160: recipe for target 'posix_sitl_default' failed
make: *** [posix_sitl_default] Error 2
16 Answers

✔️Accepted Answer

Did you try sudo apt-get install libignition-math2-dev?

Other Answers:

Just as an FYI, I hit the same error today, SITL worked with Gazebo9 but when installing Gazebo7 it croaked when building.

The fix was installing libignition math 2
sudo apt-get install libignition-math2-dev

That made SITL work again with Gazebo7.

Related Issues:

46
PX4 Autopilot Error with make posix_sitl_default gazebo with gazebo7
Did you try sudo apt-get install libignition-math2-dev? I have been using gazebo6 with ROS indigo(on...
14
PX4 Autopilot ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
I solved the same issue by adding the following line in .bashrc file in my home folder: Make sure yo...
14
PX4 Autopilot A java problem with make posix jmavsim in Ubuntu
I just ran into this again Oracle Java is not needed OpenJDK 8 is fine However Hello everybody ...
3
inav JHEMCU F7 - support !
Issue-Label Bot is automatically applying the label Feature request to this issue with a confidence ...
39
loam_velodyne loam_velodyne failed
You can try removing the line: loam_velodyne/CMakeLists.txt Line 35 in 25db5dd add_definitions( -mar...
30
carla Invalid pixelmap or window parameter
@jbeck9 I actually got this working by switching to the latest Nvidia driver 470 and running Carla w...
7
carla Building on Windows 0.8.X
Install the pre-requisites (Visual Studio 2015 This issue have changed alot since it was opened ...
6
carla 0.9.6 docker container: xdg-user-dir not found
Hmm This issue does appear to exist at least for me When executing 0.9.6 docker with The following w...
6
carla rsync: change_dir "/home/ue4/carla//./Plugins" failed: No such file or directory (2)
@thillRobot My fix was to change line 166 in Package.sh in the Docker container to: copy_if_changed ...