Segmentation error when running the examples in SITL

I have been following the tutorials in the documentation an I followed the steps here:
Library Example Sketches — Dev documentation

I attempted to run the example called RCProtocolDecoder using

cd $ARDUPILOT_HOME # the top-level of an ArduPilot repository
./waf configure --board sitl
./waf build --target examples/RCProtocolDecoder

and then

sudo ./build/sitl/examples/RCProtocolDecoder -M quad -C

(Note that SITL by itself works and I also tried keeping it open in another terminal while i executed this code)

and this is what I get →

Suggested EK3_DRAG_BCOEF_* = 16.288, EK3_DRAG_MCOEF = 0.209
Starting sketch ‘UNKNOWN’
Starting SITL input
ERROR: segmentation fault - aborting
Running: sh Tools/scripts/dumpstack.sh 19892 >dumpstack.sh_AC_PID_test.19892.out 2>&1
dumpstack.sh has been run. Output was:
-------------- begin dumpstack.sh output ----------------
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/x86_64-linux-gnu/libthread_db.so.1”.
0x00007f0b362ea45a in __GI___wait4 (pid=19893, stat_loc=stat_loc@entry=0x7ffc9ec9f188, options=options@entry=0, usage=usage@entry=0x0) at …/sysdeps/unix/sysv/linux/wait4.c:30
30 …/sysdeps/unix/sysv/linux/wait4.c: No such file or directory.
#0 0x00007f0b362ea45a in __GI___wait4 (pid=19893, stat_loc=stat_loc@entry=0x7ffc9ec9f188, options=options@entry=0, usage=usage@entry=0x0) at …/sysdeps/unix/sysv/linux/wait4.c:30
sc_ret = -512
sc_ret =
#1 0x00007f0b362ea41b in __GI___waitpid (pid=, stat_loc=stat_loc@entry=0x7ffc9ec9f188, options=options@entry=0) at ./posix/waitpid.c:38
No locals.
#2 0x00007f0b36250bcb in do_system (line=) at …/sysdeps/posix/system.c:171
__result =
_cleanup_start_doit = true
_buffer = {__routine = 0x7f0b36250c50 <cancel_handler>, __arg = 0x7ffc9ec9f190, __canceltype = 0, __prev = 0x0}
_cleanup_routine = 0x7f0b36250c50 <cancel_handler>
cancel_args = {quit = 0x7f0b3641b7a0 , intr = 0x7f0b3641b840 , pid = 19893}
status = -1
ret = 0
pid = 19893
sa = {__sigaction_handler = {sa_handler = 0x1, sa_sigaction = 0x1}, sa_mask = {__val = {65536, 0, 0, 0, 0, 0, 0, 0, 0, 2141192192, 0, 18446744073709551615, 0, 18446744073709551615, 0, 18446744073709551615}}, sa_flags = 0, sa_restorer = 0x7fa00000ffffffff}
omask = {__val = {1024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 140722972522208, 3618985593868515239, 4507180078957007360, 140722972522208, 2}}
reset = {__val = {6, 199, 140722972521136, 94918732252493, 140722972521520, 139686129992986, 140722972521536, 140722972521376, 140724530937857, 140722972522208, 140722972522208, 140722972522208, 140722972522208, 140722972522284, 140722972522407, 140722972522208}}
spawn_attr = {__flags = 12, __pgrp = 0, __sd = {__val = {6, 199, 140722972521136, 94918732252493, 140722972521520, 139686129992986, 140722972521536, 140722972521376, 140724530937857, 140722972522208, 140722972522208, 140722972522208, 140722972522208, 140722972522284, 140722972522407, 140722972522208}}, __ss = {__val = {1024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 140722972522208, 3618985593868515239, 4507180078957007360, 140722972522208, 2}}, __sp = {sched_priority = 0}, __policy = 0, __pad = {0 <repeats 16 times>}}
#3 0x00005653fd47737d in AP_HAL::run_command_on_ownpid(char const*) ()
No symbol table info available.
#4 0x00005653fd477c4c in _sig_segv(int) ()
No symbol table info available.
#5
No locals.
#6 0x00005653fd4742c2 in HALSITL::SITL_State::_simulator_servos(sitl_input&) ()
No symbol table info available.
#7 0x00005653fd474d7f in HALSITL::SITL_State::_fdm_input_local() ()
No symbol table info available.
#8 0x00005653fd47540d in HALSITL::SITL_State::_fdm_input_step() ()
No symbol table info available.
#9 0x00005653fd47554d in HALSITL::SITL_State::wait_clock(unsigned long) ()
No symbol table info available.
#10 0x00005653fd47629c in HALSITL::Scheduler::delay(unsigned short) ()
No symbol table info available.
#11 0x00005653fd47154d in HAL_SITL::run(int, char* const*, AP_HAL::HAL::Callbacks*) const ()
No symbol table info available.
#12 0x00005653fd45b884 in main ()
No symbol table info available.

Thread 1 (Thread 0x7f0b368a9740 (LWP 19892) “AC_PID_test”):
#0 0x00007f0b362ea45a in __GI___wait4 (pid=19893, stat_loc=stat_loc@entry=0x7ffc9ec9f188, options=options@entry=0, usage=usage@entry=0x0) at …/sysdeps/unix/sysv/linux/wait4.c:30
sc_ret = -512
sc_ret =
#1 0x00007f0b362ea41b in __GI___waitpid (pid=, stat_loc=stat_loc@entry=0x7ffc9ec9f188, options=options@entry=0) at ./posix/waitpid.c:38
No locals.
#2 0x00007f0b36250bcb in do_system (line=) at …/sysdeps/posix/system.c:171
__result =
_cleanup_start_doit = true
_buffer = {__routine = 0x7f0b36250c50 <cancel_handler>, __arg = 0x7ffc9ec9f190, __canceltype = 0, __prev = 0x0}
_cleanup_routine = 0x7f0b36250c50 <cancel_handler>
cancel_args = {quit = 0x7f0b3641b7a0 , intr = 0x7f0b3641b840 , pid = 19893}
status = -1
ret = 0
pid = 19893
sa = {__sigaction_handler = {sa_handler = 0x1, sa_sigaction = 0x1}, sa_mask = {__val = {65536, 0, 0, 0, 0, 0, 0, 0, 0, 2141192192, 0, 18446744073709551615, 0, 18446744073709551615, 0, 18446744073709551615}}, sa_flags = 0, sa_restorer = 0x7fa00000ffffffff}
omask = {__val = {1024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 140722972522208, 3618985593868515239, 4507180078957007360, 140722972522208, 2}}
reset = {__val = {6, 199, 140722972521136, 94918732252493, 140722972521520, 139686129992986, 140722972521536, 140722972521376, 140724530937857, 140722972522208, 140722972522208, 140722972522208, 140722972522208, 140722972522284, 140722972522407, 140722972522208}}
spawn_attr = {__flags = 12, __pgrp = 0, __sd = {__val = {6, 199, 140722972521136, 94918732252493, 140722972521520, 139686129992986, 140722972521536, 140722972521376, 140724530937857, 140722972522208, 140722972522208, 140722972522208, 140722972522208, 140722972522284, 140722972522407, 140722972522208}}, __ss = {__val = {1024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 9196350441231745024, 140722972522208, 3618985593868515239, 4507180078957007360, 140722972522208, 2}}, __sp = {sched_priority = 0}, __policy = 0, __pad = {0 <repeats 16 times>}}
#3 0x00005653fd47737d in AP_HAL::run_command_on_ownpid(char const*) ()
No symbol table info available.
#4 0x00005653fd477c4c in _sig_segv(int) ()
No symbol table info available.
#5
No locals.
#6 0x00005653fd4742c2 in HALSITL::SITL_State::_simulator_servos(sitl_input&) ()
No symbol table info available.
#7 0x00005653fd474d7f in HALSITL::SITL_State::_fdm_input_local() ()
No symbol table info available.
#8 0x00005653fd47540d in HALSITL::SITL_State::_fdm_input_step() ()
No symbol table info available.
#9 0x00005653fd47554d in HALSITL::SITL_State::wait_clock(unsigned long) ()
No symbol table info available.
#10 0x00005653fd47629c in HALSITL::Scheduler::delay(unsigned short) ()
No symbol table info available.
#11 0x00005653fd47154d in HAL_SITL::run(int, char* const*, AP_HAL::HAL::Callbacks*) const ()
No symbol table info available.
#12 0x00005653fd45b884 in main ()
No symbol table info available.
A debugging session is active.

Inferior 1 [process 19892] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (process 19892) detached]
-------------- end dumpstack.sh output ----------------
Running: sh Tools/scripts/dumpcore.sh 19892 >dumpcore.sh_AC_PID_test.19892.out 2>&1
dumpcore.sh has been run. Output was:
-------------- begin dumpcore.sh output ----------------
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/x86_64-linux-gnu/libthread_db.so.1”.
0x00007f0b362ea45a in __GI___wait4 (pid=19909, stat_loc=stat_loc@entry=0x7ffc9ec9f188, options=options@entry=0, usage=usage@entry=0x0) at …/sysdeps/unix/sysv/linux/wait4.c:30
30 …/sysdeps/unix/sysv/linux/wait4.c: No such file or directory.
warning: target file /proc/19892/cmdline contained unexpected null characters
warning: Memory read failed for corefile section, 4096 bytes at 0xffffffffff600000.
Saved corefile ap-19910.core
A debugging session is active.

Inferior 1 [process 19892] will be detached.

Quit anyway? (y or n) [answered Y; input not from terminal]
[Inferior 1 (process 19892) detached]

I also find this problem

1 Like

Please let me know If you fixed it

i also encountered this problem

I am facing the same error could anyone please help. I really don’t know whom to ask for this so forwarding some names here @peterbarker @rmackay9.

Same here, facing the same problem

Examples aren’t well maintained as they aren’t run as part of CI… So a lot of dependencies changes break them.

Most of the time the errors will explain what library instantiation is missing to run the example. So you need to check your output

1 Like