Open joelihn opened 4 years ago
After add -latomic to LDFLAGS, i can build picam.
But when i run the program, it crashed.
Here is the information:
pi@raspberrypi:~/Joe/picam $ gdb --args ./picam -o /run/shm/hls --hlsenc --hlsenckeyuri enc.key --hlsenckey f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff --hlsenciv 000102030405060708090a0b0c0d0e0f --alsadev hw:2,0
GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./picam...done.
(gdb) run
Starting program: /home/pi/Joe/picam/picam -o /run/shm/hls --hlsenc --hlsenckeyuri enc.key --hlsenckey f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff --hlsenciv 000102030405060708090a0b0c0d0e0f --alsadev hw:2,0
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0xb61aa420 (LWP 1128)]
configuring devices
[New Thread 0xb57ff420 (LWP 1129)]
[New Thread 0xb4dff420 (LWP 1130)]
[New Thread 0xb45fe420 (LWP 1131)]
[New Thread 0xb3dfd420 (LWP 1132)]
[New Thread 0xb35fc420 (LWP 1133)]
[New Thread 0xb2dfb420 (LWP 1134)]
capturing started
Thread 8 "ILCS_HOST" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb2dfb420 (LWP 1134)]
0x000cf2e4 in hls_write_packet (hls=0x16deba8, pkt=0xb2dfab90, pkt@entry=0x0, split=<optimized out>) at httplivestreaming.c:351
351 pmt_cc = ts_st->service->pmt.cc;
(gdb) bt
#0 0x000cf2e4 in hls_write_packet (hls=0x16deba8, pkt=0xb2dfab90, pkt@entry=0x0, split=<optimized out>) at httplivestreaming.c:351
#1 0x000cc144 in send_keyframe (consume_time=<optimized out>, data_len=<optimized out>, data=0xdf70f0 <encoded_packets_size> "p\003") at stream.c:2235
#2 video_encode_fill_buffer_done (out=0x170c9f0) at stream.c:3747
#3 encode_and_send_image () at stream.c:4141
#4 cam_fill_buffer_done (data=<optimized out>, comp=<optimized out>) at stream.c:3077
#5 0x000d7104 in ilclient_fill_buffer_done (hComponent=0x16eb820, pAppData=0x16eb770, pBuffer=0x16ec460) at ilclient.c:1736
#6 0xb6f14108 in vcil_out_fill_buffer_done () from /opt/vc/lib/libopenmaxil.so
#7 0xb6f10fd8 in ilcs_command () from /opt/vc/lib/libopenmaxil.so
#8 0xb6f11e40 in ilcs_task () from /opt/vc/lib/libopenmaxil.so
#9 0xb6ececb0 in vcos_thread_entry (arg=0x16e15e8) at /home/dom/projects/staging/userland/interface/vcos/pthreads/vcos_pthreads.c:144
#10 0xb6e92494 in start_thread (arg=0xb2dfb420) at pthread_create.c:486
#11 0xb65cb578 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) where
#0 0x000cf2e4 in hls_write_packet (hls=0x16deba8, pkt=0xb2dfab90, pkt@entry=0x0, split=<optimized out>) at httplivestreaming.c:351
#1 0x000cc144 in send_keyframe (consume_time=<optimized out>, data_len=<optimized out>, data=0xdf70f0 <encoded_packets_size> "p\003") at stream.c:2235
#2 video_encode_fill_buffer_done (out=0x170c9f0) at stream.c:3747
#3 encode_and_send_image () at stream.c:4141
#4 cam_fill_buffer_done (data=<optimized out>, comp=<optimized out>) at stream.c:3077
#5 0x000d7104 in ilclient_fill_buffer_done (hComponent=0x16eb820, pAppData=0x16eb770, pBuffer=0x16ec460) at ilclient.c:1736
#6 0xb6f14108 in vcil_out_fill_buffer_done () from /opt/vc/lib/libopenmaxil.so
#7 0xb6f10fd8 in ilcs_command () from /opt/vc/lib/libopenmaxil.so
#8 0xb6f11e40 in ilcs_task () from /opt/vc/lib/libopenmaxil.so
#9 0xb6ececb0 in vcos_thread_entry (arg=0x16e15e8) at /home/dom/projects/staging/userland/interface/vcos/pthreads/vcos_pthreads.c:144
#10 0xb6e92494 in start_thread (arg=0xb2dfb420) at pthread_create.c:486
#11 0xb65cb578 in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:73 from /lib/arm-linux-gnueabihf/libc.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
I just tried to build and got the exact same backtrace. My guess is it's a problem with the ffmpeg version I built? The docs for BUILDING.md
don't specify a version and/or commit to build from. Could be a red herring but it seems like the most likely culprit at the moment. I'll try to update you if I learn more.
This PR should fix the segfault: https://github.com/iizukanao/picam/pull/153
You can get around the requirement for -latomic
by using ffmpeg version 4.3
. We should update BUILDING.md
to reflect what version of ffmpeg to pull.
And this PR should clarify what version of ffmpeg to build so you don't get the undefined reference
errors for missing -latomic
: https://github.com/iizukanao/picam/pull/155