[FFmpeg-user] compiling for android
Patrick Shirkey
pshirkey at boosthardware.com
Wed Jul 9 10:13:46 CEST 2014
On Wed, July 9, 2014 4:48 pm, 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.
>
> I forgot to add that the script in question is known
> to contains severe deficiencies, so it really shouldn't
> be used.
>
FWIW, it worked well for me without x264 and limited knowledge of the
ffmpeg arm/android build process at the time. I was able to quickly build
an almost complete set of binaries and have them included in the fw image
automatically. When I have the build with x264 working I would still like
to utilise parts of the script to include ffmpeg in the /external tree. It
utilises ./configure too but has additional code which modifies various
config files before building which appears to fix the sincos/sincosf issue
while running the script. I am not sure why it works as running the script
manually doesn't help with the default built process.
i.e.
cat config.h | \
sed 's/\#define av_restrict /\#ifdef av_restrict\n\#undef
av_restrict\n\#endif\n\#define av_restrict /g' | \
sed 's/\#define ARCH_ARM /\#ifdef ARCH_ARM\n\#undef
ARCH_ARM\n\#endif\n\#define ARCH_ARM /g' | \
sed 's/\#define ARCH_MIPS /\#ifdef ARCH_MIPS\n\#undef
ARCH_MIPS\n\#endif\n\#define ARCH_MIPS /g' | \
sed 's/\#define ARCH_X86 /\#ifdef ARCH_X86\n\#undef
ARCH_X86\n\#endif\n\#define ARCH_X86 /g' | \
sed 's/\#define HAVE_PTHREADS/\#ifdef HAVE_PTHREADS\n\#undef
HAVE_PTHREADS\n\#endif\n\#define HAVE_PTHREADS/g' | \
sed 's/\#define HAVE_MALLOC_H/\#ifdef HAVE_MALLOC_H\n\#undef
HAVE_MALLOC_H\n\#endif\n\#define HAVE_MALLOC_H/g' | \
sed 's/\#define HAVE_STRERROR_R 1/\#define HAVE_STRERROR_R
0/g' | \
sed 's/\#define HAVE_SYSCTL 1/\#define HAVE_SYSCTL 0/g' | \
cat > config.h.tmp; \
mv config.h config.h.bak; \
mv config.h.tmp config.h; \
\
cat config.mak | \
sed 's/HAVE_STRERROR_R=yes/!HAVE_STRERROR_R=yes/g' | \
sed 's/HAVE_SYSCTL=yes/!HAVE_SYSCTL=yes/g' | \
cat > config.mak.tmp; \
mv config.mak config.mak.bak; \
mv config.mak.tmp config.mak;
Finally it installs everything (without x264 enabled) into the correct
location in the /out/... folders.
I haven't seen any other attempts with the last step anywhere else.
> If something is wrong with our configure script,
> *please* report it.
>
> [...]
>
>> Here's the full configure :
>>
>> ./configure --arch=arm --target-os=linux --enable-cross-compile \
>> --cross-prefix=/4.4/prebuilts/gcc/linux-x86/arm/
>> arm-linux-androideabi-4.7/bin/arm-linux-androideabi- \
>> --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' \
>> --extra-libs="/4.4/external/x264/libx264.a";
>
> --disable-shared --enable-static --enable-encoder=libx264
> are the default, please remove them.
>
> The --extra-libs option looks wrong / superfluous, please
> remove it.
> If your libx264 library is in /4.4/external/x264, you have to
> tell configure with --extra-ldflags=-L/4.4/external/x264
>
I tried several variations on that based on the details on this page on
stackoverflow which comes up near the top of the search results for me.
http://stackoverflow.com/questions/8812827/build-ffmpeg-with-x264-for-android
Strangely with your suggestion of just -L and no -I it finds the library.
My previous attempts were not able to find it for some reason which is why
I resorted to --extra-libs and dropped -L / -I completely
> Why are --extra-cflags needed?
>
No specific reason. They worked for the script above without x264 so I was
starting from there.
> arm compilations often use --cpu (in your case: --cpu=cortex-a8)
>
> What is failing when using above configure line?
>
With the following configure the build is much cleaner but it still bails
out on the same location.
"undefined reference to sincos/sincosf"
- I tried with/without --extra-cflags
- I run make clean between builds
- I left the warnings in this time but I don't think they are relevant. I
get the same warnings when building x264.
./configure --arch=arm --target-os=linux --cpu=cortex-a8
--enable-cross-compile \
--cross-prefix=/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-
\
--sysroot=/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm \
--enable-gpl --enable-avresample --enable-libx264 \
--extra-cflags='-DGNU_SOURCE -fno-builtin-sin -fno-builtin-cos' \
--extra-ldflags='-Wl,--fix-cortex-a8,-L/.4.4/external/x264'
AR libavutil/libavutil.a
AR libpostproc/libpostproc.a
LD ffmpeg_g
LD ffprobe_g
LD ffserver_g
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld:
warning: cannot scan executable section 1 of
/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/lib/libx264.a(pixel-a.o)
for Cortex-A8 erratum because it has no mapping symbols.
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld:
warning: cannot scan executable section 1 of
/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/lib/libx264.a(mc-a.o)
for Cortex-A8 erratum because it has no mapping symbols.
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld:
warning: cannot scan executable section 1 of
/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/lib/libx264.a(dct-a.o)
for Cortex-A8 erratum because it has no mapping symbols.
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld:
warning: cannot scan executable section 1 of
/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/lib/libx264.a(deblock-a.o)
for Cortex-A8 erratum because it has no mapping symbols.
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld:
warning: cannot scan executable section 1 of
/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/lib/libx264.a(pixel-a.o)
for Cortex-A8 erratum because it has no mapping symbols.
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld:
warning: cannot scan executable section 1 of
/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/lib/libx264.a(mc-a.o)
for Cortex-A8 erratum because it has no mapping symbols.
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld:
warning: cannot scan executable section 1 of
/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/lib/libx264.a(dct-a.o)
for Cortex-A8 erratum because it has no mapping symbols.
/4.4/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/../lib/gcc/arm-linux-androideabi/4.7/../../../../arm-linux-androideabi/bin/ld:
warning: cannot scan executable section 1 of
/4.4/prebuilts/ndk/current/platforms/android-18/arch-arm/usr/lib/libx264.a(deblock-a.o)
for Cortex-A8 erratum because it has no mapping symbols.
libavfilter/avf_showcqt.c:332: error: undefined reference to 'sincos'
libavfilter/avf_showcqt.c:335: error: undefined reference to 'sincos'
libavfilter/avf_showspectrum.c:372: error: undefined reference to 'sincos'
libavfilter/vf_deshake.c:242: error: undefined reference to 'sincos'
libavcodec/aacps_tablegen.h:154: error: undefined reference to 'sincosf'
libavcodec/aacps_tablegen.h:155: error: undefined reference to 'sincosf'
libavcodec/aacps_tablegen.h:166: error: undefined reference to 'sincosf'
libavcodec/aacps_tablegen.h:166: error: undefined reference to 'sincosf'
collect2: error: ld returned 1 exit status
make: *** [ffserver_g] Error 1
--
Patrick Shirkey
Boost Hardware Ltd
More information about the ffmpeg-user
mailing list