PX4-Autopilot: Unable to run the simulator on OSX Catalina with Gazebo or jmavsim

Describe the bug I am able to build PX4, but unable to run it with either Gazbo or jmavsim. They both fail with different errors.

For both I followed the instructions exactly from the Mac guide as well as went through the troubleshooting steps, including doing a make distclean, setting the ulimit and following the instructions for the cmake error.

jmavsim

For jmavsim - Here is the output. Note that the issue seems to be possibly something with the 3D library based on my research. I have tried it both with OpenJDK and Java SE’s JDK.

➜  Firmware git:(master) make px4_sitl jmavsim    
[0/1] cd /Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default/tmp && /Users/foyc/Workspace/p...none /Users/foyc/Workspace/px4/Firmware /Users/foyc/Workspace/px4/Firmware/build/px4_sitl_defaul
SITL ARGS
sitl_bin: /Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default/bin/px4
debugger: none
program: jmavsim
model: none
world: none
src_path: /Users/foyc/Workspace/px4/Firmware
build_path: /Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default
empty model, setting iris as default
SITL COMMAND: "/Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default/bin/px4" "/Users/foyc/Workspace/px4/Firmware"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t "/Users/foyc/Workspace/px4/Firmware"/test_data
INFO  [px4] Creating symlink /Users/foyc/Workspace/px4/Firmware/ROMFS/px4fmu_common -> /Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default/tmp/rootfs/etc

______  __   __    ___ 
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

px4 starting.

INFO  [px4] Calling startup script: /bin/sh etc/init.d-posix/rcS 0
INFO  [param] selected parameter default file eeprom/parameters_10016
[param] parameter file not found, creating eeprom/parameters_10016
  SYS_AUTOCONFIG: curr: 0 -> new: 1
* SYS_AUTOSTART: curr: 0 -> new: 10016
  BAT_N_CELLS: curr: 0 -> new: 3
  CAL_ACC0_ID: curr: 0 -> new: 1311244
  CAL_ACC_PRIME: curr: 0 -> new: 1311244
  CAL_GYRO0_ID: curr: 0 -> new: 2294028
  CAL_GYRO_PRIME: curr: 0 -> new: 2294028
  CAL_MAG0_ID: curr: 0 -> new: 197388
  CAL_MAG_PRIME: curr: 0 -> new: 197388
  CBRK_SUPPLY_CHK: curr: 0 -> new: 894281
  COM_DISARM_LAND: curr: 2.0000 -> new: 0.5000
  COM_OBL_ACT: curr: 0 -> new: 2
  COM_RC_IN_MODE: curr: 0 -> new: 1
  EKF2_ANGERR_INIT: curr: 0.1000 -> new: 0.0100
  EKF2_GBIAS_INIT: curr: 0.1000 -> new: 0.0100
  COM_ARM_EKF_AB: curr: 0.0017 -> new: 0.0050
  EKF2_REQ_GPS_H: curr: 10.0000 -> new: 0.5000
  IMU_INTEG_RATE: curr: 200 -> new: 250
  MC_PITCH_P: curr: 6.5000 -> new: 6.0000
  MC_PITCHRATE_P: curr: 0.1500 -> new: 0.2000
  MC_ROLL_P: curr: 6.5000 -> new: 6.0000
  MC_ROLLRATE_P: curr: 0.1500 -> new: 0.2000
  MPC_HOLD_MAX_Z: curr: 0.6000 -> new: 2.0000
  MPC_Z_VEL_I: curr: 0.1000 -> new: 0.1500
  MPC_Z_VEL_P: curr: 0.2000 -> new: 0.6000
  MPC_XY_P: curr: 0.9500 -> new: 0.8000
  MPC_XY_VEL_P: curr: 0.0900 -> new: 0.2000
  MPC_XY_VEL_D: curr: 0.0100 -> new: 0.0160
  MPC_SPOOLUP_TIME: curr: 1.0000 -> new: 0.5000
  MPC_TKO_RAMP_T: curr: 3.0000 -> new: 1.0000
  NAV_ACC_RAD: curr: 10.0000 -> new: 2.0000
  NAV_DLL_ACT: curr: 0 -> new: 2
  RTL_DESCEND_ALT: curr: 30.0000 -> new: 5.0000
  RTL_LAND_DELAY: curr: -1.0000 -> new: 5.0000
  RTL_RETURN_ALT: curr: 60.0000 -> new: 30.0000
  SDLOG_MODE: curr: 0 -> new: 1
  SDLOG_PROFILE: curr: 3 -> new: 131
  SDLOG_DIRS_MAX: curr: 0 -> new: 7
  SENS_BOARD_X_OFF: curr: 0.0000 -> new: 0.0000
  SENS_DPRES_OFF: curr: 0.0000 -> new: 0.0010
  TRIG_INTERFACE: curr: 4 -> new: 3
  COM_CPU_MAX: curr: 90.0000 -> new: -1.0000
* RTL_DESCEND_ALT: curr: 5.0000 -> new: 10.0000
* RTL_LAND_DELAY: curr: 5.0000 -> new: 0.0000
  PWM_MAX: curr: 2000 -> new: 1950
  PWM_MIN: curr: 1000 -> new: 1075
  GPS_UBX_DYNMODEL: curr: 7 -> new: 6
* SYS_AUTOCONFIG: curr: 1 -> new: 0
INFO  [dataman] Unknown restart, data manager file './dataman' size is 11798680 bytes
INFO  [simulator] Waiting for simulator to accept connection on TCP port 4560
Buildfile: /Users/foyc/Workspace/px4/Firmware/Tools/jMAVSim/build.xml

make_dirs:

compile:

create_run_jar:

copy_res:

BUILD SUCCESSFUL
Total time: 0 seconds
Options parsed, starting Sim.
Starting GUI...
3D [dev] 1.6.0-pre12-daily-experimental daily

2020-05-07 09:32:02.920 java[94418:1195728] Apple AWT Internal Exception: NSWindow drag regions should only be invalidated on the Main Thread!
2020-05-07 09:32:02.920 java[94418:1195728] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff2e204d07 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff66f285bf objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff2e22d50c -[NSException raise] + 9
	3   AppKit                              0x00007fff2b43424c -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 310
	4   AppKit                              0x00007fff2b41bcb2 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1416
	5   AppKit                              0x00007fff2b41b723 -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
	6   libnativewindow_macosx.jnilib       0x00000001246fbf6e Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 398
	7   ???                                 0x000000010b232407 0x0 + 4481819655
)
libc++abi.dylib: terminating with uncaught exception of type NSException
/Users/foyc/Workspace/px4/Firmware/Tools/jmavsim_run.sh: line 80: 94418 Abort trap: 6           java -XX:GCTimeRatio=20 -Djava.ext.dirs= -Djavax.accessibility.assistive_technologies=" " -jar jmavsim_run.jar $device $extra_args
^CERROR [px4] Startup script returned with return value: 2
/Users/foyc/Workspace/px4/Firmware/Tools/sitl_run.sh: line 174: kill: (94307) - No such process
ninja: build stopped: interrupted by user.
make: *** [px4_sitl] Interrupt: 2

I would also get a pop-up that the Java runner crashed, at which point I would Ctrl-C the script because it would just hang at that point.

Gazebo

For Gazebo:

➜  Firmware git:(master) make px4_sitl gazebo 
-- PX4 version: v1.11.0-beta1-179-g7207301e56
-- PX4 config file: /Users/foyc/Workspace/px4/Firmware/boards/px4/sitl/default.cmake
-- PX4 config: px4_sitl_default
-- PX4 platform: posix
-- PX4 lockstep: enabled
-- cmake build type: RelWithDebInfo
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The ASM compiler identification is Clang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Building for code coverage
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.7.7", minimum required is "3") 
-- build type is RelWithDebInfo
-- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-275-g12835b9
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default
[1/741] git submodule src/drivers/gps/devices
[4/741] git submodule src/lib/ecl
[6/741] git submodule mavlink/include/mavlink/v2.0
[9/741] git submodule Tools/sitl_gazebo
[19/741] Performing configure step for 'sitl_gazebo'
-- install-prefix: /usr/local
-- The C compiler identification is AppleClang 11.0.0.11000033
-- The CXX compiler identification is AppleClang 11.0.0.11000033
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test COMPILER_SUPPORTS_CXX17
-- Performing Test COMPILER_SUPPORTS_CXX17 - Success
-- Performing Test COMPILER_SUPPORTS_CXX14
-- Performing Test COMPILER_SUPPORTS_CXX14 - Success
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Using C++17 compiler
CMake Warning at /usr/local/lib/cmake/boost_system-1.72.0/libboost_system-variant-shared.cmake:64 (message):
  Target Boost::system already has an imported location
  '/usr/local/lib/libboost_system-mt.dylib', which will be overwritten with
  '/usr/local/lib/libboost_system.dylib'
Call Stack (most recent call first):
  /usr/local/lib/cmake/boost_system-1.72.0/boost_system-config.cmake:57 (include)
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:120 (find_package)
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:185 (boost_find_component)
  /usr/local/Cellar/cmake/3.17.2/share/cmake/Modules/FindBoost.cmake:444 (find_package)
  CMakeLists.txt:31 (find_package)


CMake Warning at /usr/local/lib/cmake/boost_filesystem-1.72.0/libboost_filesystem-variant-shared.cmake:64 (message):
  Target Boost::filesystem already has an imported location
  '/usr/local/lib/libboost_filesystem-mt.dylib', which will be overwritten
  with '/usr/local/lib/libboost_filesystem.dylib'
Call Stack (most recent call first):
  /usr/local/lib/cmake/boost_filesystem-1.72.0/boost_filesystem-config.cmake:57 (include)
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:120 (find_package)
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:185 (boost_find_component)
  /usr/local/Cellar/cmake/3.17.2/share/cmake/Modules/FindBoost.cmake:444 (find_package)
  CMakeLists.txt:31 (find_package)


-- Found Boost: /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version "1.72.0", minimum required is "1.58") found components: system thread filesystem 
CMake Error at CMakeLists.txt:32 (find_package):
  By not providing "Findgazebo.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "gazebo", but
  CMake did not find one.

  Could not find a package configuration file provided by "gazebo" with any
  of the following names:

    gazeboConfig.cmake
    gazebo-config.cmake

  Add the installation prefix of "gazebo" to CMAKE_PREFIX_PATH or set
  "gazebo_DIR" to a directory containing one of the above files.  If "gazebo"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeOutput.log".
[27/741] Building CXX object src/lib/ecl/EKF/CMakeFiles/ecl_EKF.dir/ekf.cpp.o
FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-configure 
cd /Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default/build_gazebo && /usr/local/Cellar/cmake/3.17.2/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DSEND_ODOMETRY_DATA=ON -GNinja /Users/foyc/Workspace/px4/Firmware/Tools/sitl_gazebo && /usr/local/Cellar/cmake/3.17.2/bin/cmake -E touch /Users/foyc/Workspace/px4/Firmware/build/px4_sitl_default/external/Stamp/sitl_gazebo/sitl_gazebo-configure
[33/741] Building CXX object src/lib/ecl/EKF/CMakeFiles/ecl_EKF.dir/covariance.cpp.o
ninja: build stopped: subcommand failed.
make: *** [px4_sitl] Error 1

I found https://github.com/PX4/Firmware/issues/5393 from 2016 which talked about needing libgazebo7-dev. It’s possible that I missed something in the installation instructions. I wasn’t sure if I should install Gazebo from source.

If I can provide any other information or test anything happy to! I know how running an open-source project can be.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I can confirm this works.

Did the following:

brew upgrade

brew reinstall --build-from-source gazebo9

make clean on PX4 firmware

Gazebo 9 working under macOS 10.15.4 with PX4 Master

@julianoes Awesome, thanks for reopening. That’s correct - neither is building. I tried just now to reinstall Gazbo with brew, but I’m getting:

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:329:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;

which doesn’t seem like an issue with PX4 at all, but I don’t have time to debug right this second. I’ll look at it at the PR you so kindly put up within the next 36 hours and report back!