问题
I'm compiling ffmpeg with gcc 4.6 (as this is default on ndk r9) for armv7-a devices and a weird crash occurs on certain devices that didn't happen when running code compiled with gcc 4.4.3.
this is the backtrace:
08-02 18:36:08.200: I/sec_anm_ahi_output(1535): setParameters(stop_output_streamtype=1)
08-02 18:36:08.360: I/DEBUG(18804): #00 pc 000162a0 /system/lib/libc.so (__libc_android_abort)
08-02 18:36:08.360: I/DEBUG(18804): #01 pc 00418334 /data/data/com.ffmpeg.android/lib/libffmpeg.so (__check_for_sync8_kernelhelper)
08-02 18:36:08.360: I/DEBUG(18804): libc base address: afd00000
After searching on google, it seems the problem is in 64-bit atomic as it seems my compiled code it's not using dmb instructions instead it's calling kernelhelper:
https://code.google.com/p/android/issues/detail?id=41297
http://www.ogre3d.org/forums/viewtopic.php?f=21&t=78199
The workaround it's to compile for armv7-a, but I'm already doing this with the same results. These are the flags I'm using:
CPU=armv7-a
OPTIMIZE_CFLAGS="-march=$CPU -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb -D__thumb__"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -march=armv7-a"
PREFIX=./android/$CPU
EXTRA_CONFIGURE=""
I have also tried with these, but with same results:
CPU=armv7-a
OPTIMIZE_CFLAGS="-march=$CPU -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb -D__thumb__"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -march=armv7-a"
PREFIX=./android/$CPU
EXTRA_CONFIGURE="--disable-armv5te --disable-armv6 --disable-armv6t2"
I have tested on different devices and these are the results:
Nexus 4 - No Crash
Nexus 7 - No crash
Galaxy sII - Crash
Galaxy Ace 2 - Crash
I would appreciate any help.
Thanks.
来源:https://stackoverflow.com/questions/18022312/android-gcc-4-6-crash-on-check-for-sync8-kernelhelper-arm-ffmpeg