Hello. I need to build ffmpeg as library for android. I use slightly modified
bambuser script and I made it work on current ffmpeg version (I needed some
ADPCM and H264 decoders). Recently I found out I need Speex decoder (and
possibly encoder) as well, so I tried adding it to project. However this is
where I find problems. I can easily run configure without cross-compile but
with libspeex added, I can cross-compile without libspeex, but when I try to
cross-compile with libspeex I get an error “speex not found using pkg-config”.
I downloaded Speex and compiled it - no success. I installed it by Brew - no
success. I tried adding prefix when compiling Speex - still nothing. Same with
adding CFLAGS and LDFLAGS. I tried numerous ways of adding it to the project,
but no matter what do I do I get the same error, every single time.
Long story short: how can I compile ffmpeg to Android .so library with Speex
decoder inside? If that matters I use OS X system.
My build script:
#!/bin/bash
if [ "$NDK" = "" ]; then
echo NDK variable not set, assuming ${HOME}/android-ndk
export NDK=${HOME}/Library/Android/sdk/ndk-bundle
fi
SYSROOT=$NDK/platforms/android-16/arch-arm
# Expand the prebuilt/* path into the correct one
TOOLCHAIN=`echo
$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64`
export PATH=$TOOLCHAIN/bin:$PATH
rm -rf build/ffmpeg
mkdir -p build/ffmpeg
cd ffmpeg
# Don't build any neon version for now
for version in armv5te armv7a; do
DEST=../build/ffmpeg
FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi-
--arch=arm"
FLAGS="$FLAGS --sysroot=$SYSROOT"
#FLAGS="$FLAGS --soname-prefix=/data/data/com.bambuser.broadcaster/lib/"
FLAGS="$FLAGS --enable-shared --disable-symver"
FLAGS="$FLAGS --enable-small"
#--optimization-flags=-O2"
FLAGS="$FLAGS --disable-everything"
# FLAGS="$FLAGS --enable-encoder=mpeg2video --enable-encoder=nellymoser"
FLAGS="$FLAGS --enable-decoder=h264 --enable-decoder=adpcm_ima_oki
--enable-decoder=adpcm_ima_ws"
FLAGS="$FLAGS --enable-encoder=adpcm_ima_qt --enable-encoder=adpcm_ima_wav
--enable-encoder=adpcm_g726"
FLAGS="$FLAGS --enable-encoder=adpcm_g722 --enable-libspeex"
case "$version" in
armv7a)
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp"
EXTRA_LDFLAGS=""
ABI="armeabi-v7a"
;;
*)
EXTRA_CFLAGS=""
EXTRA_LDFLAGS=""
ABI="armeabi"
;;
esac
DEST="$DEST/$ABI"
FLAGS="$FLAGS --prefix=$DEST"
EXTRA_CFLAGS="$EXTRA_CFLAGS -I/usr/local/include/"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/usr/local/lib"
mkdir -p $DEST
echo $FLAGS --extra-cflags="$EXTRA_CFLAGS"
--extra-ldflags="$EXTRA_LDFLAGS" > $DEST/info.txt
./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS"
--extra-ldflags="$EXTRA_LDFLAGS" | tee $DEST/configuration.txt
[ $PIPESTATUS == 0 ] || exit 1
rm compat/strtod.o
rm compat/strtod.d
make clean
make -j4 || exit 1
make install || exit 1
done
Config.log fragment with error:
arm-linux-androideabi-gcc
--sysroot=/Users/mgriszbacher/Library/Android/sdk/ndk-bundle/platforms/android-16/arch-arm
-isysroot
/Users/mgriszbacher/Library/Android/sdk/ndk-bundle/platforms/android-16/arch-arm
-D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-Dstrtod=avpriv_strtod -DPIC -I/usr/local/include/ -march=armv5te -std=c99
-fomit-frame-pointer -fPIC -marm -pthread -c -o /tmp/ffconf.rYieelIt.o
/tmp/ffconf.6y5cL6p4.c
arm-linux-androideabi-gcc -L/usr/local/lib
--sysroot=/Users/mgriszbacher/Library/Android/sdk/ndk-bundle/platforms/android-16/arch-arm
-isysroot
/Users/mgriszbacher/Library/Android/sdk/ndk-bundle/platforms/android-16/arch-arm
-march=armv5te -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.TDeNtAx9
/tmp/ffconf.rYieelIt.o -lm -lz -pthread
check_complexfunc cabs 1
check_ld cc
check_cc
BEGIN /tmp/ffconf.6y5cL6p4.c
1 #include <complex.h>
2 #include <math.h>
3 float foo(complex float f, complex float g) { return cabs(f * I); }
4 int main(void){ return (int) foo; }
END /tmp/ffconf.6y5cL6p4.c
arm-linux-androideabi-gcc
--sysroot=/Users/mgriszbacher/Library/Android/sdk/ndk-bundle/platforms/android-16/arch-arm
-isysroot
/Users/mgriszbacher/Library/Android/sdk/ndk-bundle/platforms/android-16/arch-arm
-D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-Dstrtod=avpriv_strtod -DPIC -I/usr/local/include/ -march=armv5te -std=c99
-fomit-frame-pointer -fPIC -marm -pthread -c -o /tmp/ffconf.rYieelIt.o
/tmp/ffconf.6y5cL6p4.c
/tmp/ffconf.6y5cL6p4.c:1:21: fatal error: complex.h: No such file or directory
#include <complex.h>
^
compilation terminated.
check_complexfunc cexp 1
check_ld cc
check_cc
BEGIN /tmp/ffconf.6y5cL6p4.c
1 #include <complex.h>
2 #include <math.h>
3 float foo(complex float f, complex float g) { return cexp(f * I); }
4 int main(void){ return (int) foo; }
END /tmp/ffconf.6y5cL6p4.c
arm-linux-androideabi-gcc
--sysroot=/Users/mgriszbacher/Library/Android/sdk/ndk-bundle/platforms/android-16/arch-arm
-isysroot
/Users/mgriszbacher/Library/Android/sdk/ndk-bundle/platforms/android-16/arch-arm
-D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-Dstrtod=avpriv_strtod -DPIC -I/usr/local/include/ -march=armv5te -std=c99
-fomit-frame-pointer -fPIC -marm -pthread -c -o /tmp/ffconf.rYieelIt.o
/tmp/ffconf.6y5cL6p4.c
/tmp/ffconf.6y5cL6p4.c:1:21: fatal error: complex.h: No such file or directory
#include <complex.h>
^
compilation terminated.
check_pkg_config speex speex/speex.h speex_decoder_init -lspeex
false --exists --print-errors speex
ERROR: speex not found using pkg-config
_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".