PX4 / PX4-Autopilot

PX4 Autopilot Software
https://px4.io
BSD 3-Clause "New" or "Revised" License
8.59k stars 13.56k forks source link

SegFault while trying to run SITL on Mac OS Big Sur #16284

Open saksham2001 opened 4 years ago

saksham2001 commented 4 years ago

Describe the bug I have encountered Segmentation Fault while trying to run px4_sitl with jmavsim on Mac OS Big Sur.

To Reproduce Steps to reproduce the behavior:

  1. Installed the PX4 Dev Toolchain based on PX4 Dev Guide Though while running this command brew cask install xquartz java, I encountered this error error cask 'java' is unavailable. So, I used this command to install java brew cask install adoptopenjdk/openjdk/adoptopenjdk8.

  2. Clone the PX4 Repo

  3. To Run the SITL, I used the command make px4_sitl jmavsim after which I encountered this error-

(ComputerVision) sakshambhutani@Sakshams-MacBook-Pro Firmware % make px4_sitl jmavsim
-- PX4 version: v1.11.0-rc3-732-g5382d3b8fb
-- PX4 config file: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/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 12.0.0.12000032
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Building for code coverage
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
-- Found PythonInterp: /Users/sakshambhutani/.conda/envs/ComputerVision/bin/python3 (found suitable version "3.8.5", minimum required is "3") 
-- build type is RelWithDebInfo
-- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-470-gda9f314
-- ROMFS: px4fmu_common
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default
[7/759] git submodule src/drivers/gps/devices
[11/759] git submodule src/lib/ecl
[12/759] git submodule mavlink/include/mavlink/v2.0
[13/759] git submodule Tools/jMAVSim
[443/759] Linking CXX static library src/lib/bezier/libbezier.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/lib/bezier/libbezier.a(BezierQuad.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/lib/bezier/libbezier.a(BezierQuad.cpp.o) has no symbols
[470/759] Linking CXX static library src/lib/slew_rate/libSlewRate.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/lib/slew_rate/libSlewRate.a(dummy.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/lib/slew_rate/libSlewRate.a(dummy.cpp.o) has no symbols
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: src/lib/slew_rate/libSlewRate.a the table of contents is empty (no object file members in the library define global symbols)
[482/759] Linking CXX static library src/drivers/camera_trigger/libdrivers__camera_trigger.a
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/drivers/camera_trigger/libdrivers__camera_trigger.a(pwm.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/drivers/camera_trigger/libdrivers__camera_trigger.a(seagull_map2.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/drivers/camera_trigger/libdrivers__camera_trigger.a(gpio.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/drivers/camera_trigger/libdrivers__camera_trigger.a(pwm.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/drivers/camera_trigger/libdrivers__camera_trigger.a(seagull_map2.cpp.o) has no symbols
/Library/Developer/CommandLineTools/usr/bin/ranlib: file: src/drivers/camera_trigger/libdrivers__camera_trigger.a(gpio.cpp.o) has no symbols
[758/759] cd "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicle...charmProjects/MachineLearning/Autonomous\ Vehicles/PX4/Firmware/build/px4_sitl_default
SITL ARGS
sitl_bin: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/bin/px4
debugger: none
program: jmavsim
model: none
world: none
src_path: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware
build_path: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default
empty model, setting iris as default
SITL COMMAND: "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/bin/px4" "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default"/etc -s etc/init.d-posix/rcS -t "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware"/test_data
INFO  [px4] Creating symlink /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/etc -> /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/tmp/rootfs/etc
/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/Tools/sitl_run.sh: line 218: 60918 Segmentation fault: 11  "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/bin/px4" "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default"/etc -s etc/init.d-posix/rcS -t "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware"/test_data
  1. To debug this, I also tried this command PX4_ASAN=1 make px4_sitl jmavsim after which I encountered this -
(ComputerVision) sakshambhutani@Sakshams-MacBook-Pro Firmware % PX4_ASAN=1 make px4_sitl jmavsim
-- PX4 version: v1.11.0-rc3-732-g5382d3b8fb
-- PX4 config file: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/boards/px4/sitl/default.cmake
-- PX4 config: px4_sitl_default
-- PX4 platform: posix
-- PX4 lockstep: enabled
-- cmake build type: AddressSanitizer
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The ASM compiler identification is Clang
-- Found assembler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Building for code coverage
-- AddressSanitizer enabled
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
-- Found PythonInterp: /Users/sakshambhutani/.conda/envs/ComputerVision/bin/python3 (found suitable version "3.8.5", minimum required is "3") 
-- build type is AddressSanitizer
-- PX4 ECL: Very lightweight Estimation & Control Library v1.9.0-rc1-470-gda9f314
-- ROMFS: px4fmu_common
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default
[0/759] git submodule src/drivers/gps/devices
[1/759] git submodule mavlink/include/mavlink/v2.0
[2/759] git submodule src/lib/ecl
[3/759] git submodule Tools/jMAVSim
[698/759] Linking CXX static library src/lib/slew_rate/libSlewRate.a
warning: /Library/Developer/CommandLineTools/usr/bin/ranlib: archive library: src/lib/slew_rate/libSlewRate.a the table of contents is empty (no object file members in the library define global symbols)
[758/759] cd "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicle...charmProjects/MachineLearning/Autonomous\ Vehicles/PX4/Firmware/build/px4_sitl_default
SITL ARGS
sitl_bin: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/bin/px4
debugger: none
program: jmavsim
model: none
world: none
src_path: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware
build_path: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default
empty model, setting iris as default
SITL COMMAND: "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/bin/px4" "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default"/etc -s etc/init.d-posix/rcS -t "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware"/test_data
Buildfile: /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/Tools/jMAVSim/build.xml
INFO  [px4] Creating symlink /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/etc -> /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/tmp/rootfs/etc
AddressSanitizer:DEADLYSIGNAL
=================================================================
==99177==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x7fff202430e0 bp 0x7ffee70e02a0 sp 0x7ffee70e0290 T0)
==99177==The signal is caused by a READ memory access.
==99177==Hint: this fault was caused by a dereference of a high value address (see register values below).  Dissassemble the provided pc to learn which register was used.
    #0 0x7fff202430e0 in flockfile+0x12 (libsystem_c.dylib:x86_64+0x390e0)
    #1 0x7fff20244a03 in fputs+0x41 (libsystem_c.dylib:x86_64+0x3aa03)
    #2 0x10978475e in wrap_fputs+0x1ae (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x2075e)
make_dirs:
compile:
create_run_jar:
copy_res:
BUILD SUCCESSFUL
Total time: 0 seconds
Exception in thread "main" java.lang.UnsupportedClassVersionError: me/drton/jmavsim/Simulator has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 58.0
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)
        at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:514)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:422)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:416)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:691)
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:415)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:427)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:59)
    #3 0x108e4ff67 in px4_log_modulename px4_log.cpp:91
    #4 0x108f8a0d0 in px4_daemon::Server::start() server.cpp:97
    #5 0x108b20e18 in main main.cpp:294
    #6 0x7fff20352630 in start+0x0 (libdyld.dylib:x86_64+0x15630)
==99177==Register values:
rax = 0x0000000110e2eeac  rbx = 0xe70e200000000030  rcx = 0x0000000110e2eeac  rdx = 0x0000000000000006  
rdi = 0xe70e200000000030  rsi = 0x0000000000000003  rbp = 0x00007ffee70e02a0  rsp = 0x00007ffee70e0290  
 r8 = 0xe70e200000000030   r9 = 0xffffe000231e3e34  r10 = 0x00007ffee70e1730  r11 = 0x00007fff203334e5  
r12 = 0x00001fffdce1c168  r13 = 0x00001fffdce1c16c  r14 = 0x0000000000000030  r15 = 0x0000000000000006  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (libsystem_c.dylib:x86_64+0x390e0) in flockfile+0x12
==99177==ABORTING
/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/Tools/sitl_run.sh: line 218: 99177 Abort trap: 6           "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/bin/px4" "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default"/etc -s etc/init.d-posix/rcS -t "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware"/test_data
/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/Tools/sitl_run.sh: line 225: kill: (99176) - No such process
FAILED: platforms/posix/CMakeFiles/jmavsim 
cd "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/build/px4_sitl_default/tmp" && "/Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous Vehicles/PX4/Firmware/Tools/sitl_run.sh" /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous\ Vehicles/PX4/Firmware/build/px4_sitl_default/bin/px4 none jmavsim none none /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous\ Vehicles/PX4/Firmware /Users/sakshambhutani/PycharmProjects/MachineLearning/Autonomous\ Vehicles/PX4/Firmware/build/px4_sitl_default
ninja: build stopped: subcommand failed.
make: *** [px4_sitl] Error 1

System Running this on MacOS Big Sur 11.0.1 MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports) Processor 2.3 GHz Dual-Core Intel Core i5 Memory 8 GB 2133 MHz LPDDR3

Python Version 3.8.5

dagar commented 4 years ago

It's likely going to be a while before any of the core developers are working on Big Sur or we have it available in CI. Can you debug further?