[FFmpeg-user] compiling for android

Patrick Shirkey pshirkey at boosthardware.com
Wed Jul 9 07:38:56 CEST 2014

On Wed, July 9, 2014 5:39 am, Carl Eugen Hoyos wrote:
> Patrick Shirkey <pshirkey <at> boosthardware.com> writes:
>> I have successfully compiled  and run ffmpeg and
>> ffserver on my android-4.4 device
>> using the ffmpeg4android scripts here:
> External build scripts are not supported here.

Understood.  I was hoping someone might know where to put the libx264.a
file so that the linker can find it.

FYI, for android FW developers this script is the most powerful of the
bunch as it allows building ffmpeg directly into the /external tree as a
default application.  It also builds ffserver and several other tools
(except ffplay) in both shared and static binaries. IMO this script should
be well understood by FFMPEG developers as it enables a nearly complete
ffmpeg solution to be bundled with the default android codebase.

All the other options I have found only do partial static builds. Also the
script works perfectly if I do not try to include x264 so all round it is
quite an accomplishment.

>> 2:  Using the standard build method
>>     ./configure;make
>> I cannot get past the error for sincos/sincosf which
>> is not accessible in the default NDK libm.a.
> Please elaborate.
> (configure line etc.)

Here's the full configure :

./configure --arch=arm --target-os=linux --enable-cross-compile \
--sysroot=/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm \
--disable-shared --enable-static --enable-gpl  --enable-avresample
--enable-libx264 --enable-encoder=libx264 \
--extra-cflags='-mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon
-D_GNU_SOURCE -fno-builtin-sin -fno-builtin-cos -std=c99' \
--extra-ldflags='-Wl,--fix-cortex-a8' \

- I also tried -DGNU_SOURCE

- I am working with the complete android 4.4 tree not the stand alone NDK.
math.h has ifdef _GNU_SOURCE for sincos/sincof/sincosl

- however nm shows that they are not available so they were not enabled at

 nm /4.4/prebuilts/ndk/9/platforms/android-18/arch-arm/usr/lib/libm.a |
grep sin
00000000 T __isinf
00000000 T __isinff
00000000 T __isinfl
         U sin
00000000 T asin
00000000 T asinf
         U sin
         U sinf
         U sin
         U sinf
         U sin
         U __kernel_sin
00000000 t sin_pi
         U __kernel_sindf
00000000 t sin_pif
00000000 T sinh
00000000 T sinhf
00000000 T __kernel_sin
00000000 T __kernel_sindf
00000000 T asinh
00000000 T asinhf
         U __kernel_sin
         U __kernel_sin
00000000 T sin
00000000 T sinf

- I have looked at rebuilding libm.a with GNU_SOURCE enabled but I can't
find a method for that either. That is probably outside the scope of this
thread though.

Patrick Shirkey
Boost Hardware Ltd

More information about the ffmpeg-user mailing list