[FFmpeg-user] compiling for android

Patrick Shirkey pshirkey at boosthardware.com
Thu Jul 10 09:56:47 CEST 2014


On Thu, July 10, 2014 5:23 pm, Carl Eugen Hoyos wrote:
> Nicolas George <george <at> nsup.org> writes:
>
>> Le primidi 21 messidor, an CCXXII, Patrick Shirkey a écrit :
>> > Unfortunately all these flags not working for me.
>> > Does that suggest a problem (in this case) with the
>> > compiler or ffmpeg?
>>
>> You can try to compile the following simple code:
>
> Thank you for the more useful test case!
>
>> #include <math.h>
>>
>> double test(double x)
>> {
>>     return cos(x) + sin(x);
>> }
>>
>> If the compiler from the Android NDK issues code
>> using sincos, then it is broken, since the platform
>> does not provide it.
>
> Which appears not to be unusual on Android.
>
> The complete test case:
> $ cat test.c
> #define _GNU_SOURCE
> #include <math.h>
>
> double sc(double a)
> {
> return sin(a) + cos(a);
> }
> $ gcc test.c -c && nm test.o
>                  U cos
> 0000000000000000 T sc
>                  U sin
> $ gcc test.c -c -O1 && nm test.o
> 0000000000000000 T sc
>                  U sincos
> $ gcc test.c -c -O1 -fno-builtin-sin && nm test.o
>                  U cos
> 0000000000000000 T sc
>                  U sin
> $ gcc test.c -c -O1 -fno-builtin-cos && nm test.o
>                  U cos
> 0000000000000000 T sc
>                  U sin
>
> I believe the toolchain is broken if it produces a
> sincos symbol although you compiled with -fno-builtin.
>
> (-fno-builtin-sincos has NO effect.)
>
> The define is not needed but maybe it makes the
> compiler believe that sincos() is available?
>

Here is the output:

ffmpeg-HEAD-7558e55.android$
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc
 --sysroot=/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm
../testlm2.c -c && nm testlm2.o
00000000 t $a
         U __aeabi_dadd
         U cos
00000000 T sc
         U sin

ffmpeg-HEAD-7558e55.android$
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc
 --sysroot=/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm
../testlm2.c -c -O1 && nm testlm2.o
00000000 t $a
         U __aeabi_dadd
00000000 T sc
         U sincos

ffmpeg-HEAD-7558e55.android$
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc
 --sysroot=/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm
../testlm2.c -c -O1 -fno-builtin-sin && nm testlm2.o
00000000 t $a
         U __aeabi_dadd
         U cos
00000000 T sc
         U sin

ffmpeg-HEAD-7558e55.android$
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc
 --sysroot=/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm
../testlm2.c -c -O1 -fno-builtin-cos && nm testlm2.o
00000000 t $a
         U __aeabi_dadd
         U cos
00000000 T sc
         U sin

ffmpeg-HEAD-7558e55.android$
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc
 --sysroot=/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm
../testlm2.c -c -O1 -fno-builtin-sincos && nm testlm2.o
00000000 t $a
         U __aeabi_dadd
00000000 T sc
         U sincos




--
Patrick Shirkey
Boost Hardware Ltd


More information about the ffmpeg-user mailing list