PX4 / PX4-SITL_gazebo-classic

Set of plugins, models and worlds to use with OSRF Gazebo Simulator in SITL and HITL.
http://dev.px4.io/simulation-gazebo.html
379 stars 798 forks source link

Build on M1 Macbook Pro under X86 terminates with boost::lock_error #910

Open nello opened 2 years ago

nello commented 2 years ago

Hi,

I've been trying to build this on my M1 Mac off and on for a few months now. Each time I give up and go back to my old Macbook Pro. I'm running at latest versions of the Mac OS, Homebrew and all dependencies.

I'm following the instructions here: https://docs.px4.io/main/en/dev_setup/dev_env_mac.html with no real success, having been blocked in the past with the Ogre and tbb issues amongst a host of others.

The jmavsim simulator seems to work fine, but I've never got PX4-SITL_gazebo working on M1 despite repeated attempts, including completely blowing away my entire Homebrew installation three times now.

The error this time is:

make px4_sitl gazebo
[0/4] Performing build step for 'sitl_gazebo'
ninja: no work to do.
[3/4] cd /Users/nbrennan/src/sled/PX4-Autopilot/...an/src/sled/PX4-Autopilot/build/px4_sitl_default
SITL ARGS
sitl_bin: /Users/nbrennan/src/sled/PX4-Autopilot/build/px4_sitl_default/bin/px4
debugger: none
program: gazebo
model: none
world: none
src_path: /Users/nbrennan/src/sled/PX4-Autopilot
build_path: /Users/nbrennan/src/sled/PX4-Autopilot/build/px4_sitl_default
empty model, setting iris as default
GAZEBO_PLUGIN_PATH :/Users/nbrennan/src/sled/PX4-Autopilot/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/Users/nbrennan/src/sled/PX4-Autopilot/Tools/sitl_gazebo/models
LD_LIBRARY_PATH :/Users/nbrennan/src/sled/PX4-Autopilot/build/px4_sitl_default/build_gazebo
empty world, setting empty.world as default
Using: /Users/nbrennan/src/sled/PX4-Autopilot/Tools/sitl_gazebo/models/iris/iris.sdf
Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring.
libc++abi: terminating with uncaught exception of type boost::wrapexcept<boost::lock_error>: boost: mutex lock failed in pthread_mutex_lock: Invalid argument [generic:22]
/Users/nbrennan/src/sled/PX4-Autopilot/Tools/sitl_run.sh: line 217:  2340 Abort trap: 6           gzserver $verbose $world_path $ros_args
SITL COMMAND: "/Users/nbrennan/src/sled/PX4-Autopilot/build/px4_sitl_default/bin/px4" "/Users/nbrennan/src/sled/PX4-Autopilot/build/px4_sitl_default"/etc -s etc/init.d-posix/rcS -t "/Users/nbrennan/src/sled/PX4-Autopilot"/test_data
Creating symlink /Users/nbrennan/src/sled/PX4-Autopilot/build/px4_sitl_default/etc -> /Users/nbrennan/src/sled/PX4-Auto

If anyone has any clues, I would be extremely grateful!

hill-ming commented 1 year ago

It seems to be the problem of gazebo under mac os

I set the following two environment variables export GAZEBO_PLUGIN_PATH="/Users/mingyu/git/PX4-Autopilot/build/px4_sitl_nolockstep/build_gazebo-classic" export GAZEBO_MODEL_PATH="/Users/mingyu/git/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models"

Then execute it at two terminals respectively gzserver --verbose /Users/mingyu/git/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/empty.world

gz model --verbose --spawn-file="/Users/mingyu/git/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models/iris/iris.sdf" --model-name=iris

As a result, gzserver crashed Gazebo multi-robot simulator, version 11.12.0 Copyright (C) 2012 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.org

[Msg] Waiting for master. [Msg] Connected to gazebo master @ http://127.0.0.1:11345 [Msg] Publicized address: 192.168.1.50 [Msg] Loading world file [/Users/mingyu/git/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds/empty.world] Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring. Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring. Warning [parser.cc:833] XML Attribute[version] in element[sdf] not defined in SDF, ignoring. libc++abi: terminating with uncaught exception of type boost::wrapexcept: boost: mutex lock failed in pthread_mutex_lock: Invalid argument [generic:22] [1] 28695 abort gzserver --verbose