I'm going for it, literally for a few days. I am trying to build FFmpeg with libmp3lame for use in an android application. The script line sets a flag --sysrootthat points to the Android NDK directory needed to create these libraries so that Android can use them.
The problem occurs when I add a flag to --enable-libmp3lame; At build start time I get ERROR: libmp3lame >= 3.98.3 not found. I know that LAME and its libraries are installed, because I can just start ./configure --enable-libmp3lamemanually, and the configuration starts without hesitation and shows that libmp3lame is enabled for this assembly. However, a build like this just won't work for what I need for it, since I need Android NDK to do some work.
I traced this problem to the point that this build script declares sysroot, and after some research I tried to add -Luser/include, -L/user/includeto additional flags and ldflags (which I read the default search location for gcc). I tried other things as well, but I'm sure someone here can help with this particular problem. This entire build of the script is as follows:
Additional Information:
- OS Build: Ubuntu 11.10
- FFmpeg Ver: the last of git
- LAME Ver: 3.9.x
- Android NDK: r7
build.sh
#!/bin/bash
if [ "$NDK" = "" ]; then
echo NDK variable not set, assuming ${HOME}/android-ndk
export NDK=${HOME}/android-ndk
fi
SYSROOT=$NDK/platforms/android-3/arch-arm
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
export PATH=$TOOLCHAIN/bin:$PATH
rm -rf build/ffmpeg
mkdir -p build/ffmpeg
cd ffmpeg
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/net.smartnotes/lib/"
FLAGS="$FLAGS --enable-shared --disable-symver"
FLAGS="$FLAGS --enable-small --optimization-flags=-O2"
FLAGS="$FLAGS --disable-everything --enable-protocol=file"
FLAGS="$FLAGS --enable-libmp3lame --enable-encoder=nellymoser"
case "$version" in
neon)
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8"
ABI="armeabi-v7a"
;;
armv7a)
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp"
EXTRA_LDFLAGS=""
ABI="armeabi-v7a"
;;
*)
EXTRA_CFLAGS="-Luser/include"
EXTRA_LDFLAGS=""
ABI="armeabi"
;;
esac
DEST="$DEST/$ABI"
FLAGS="$FLAGS --prefix=$DEST"
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
make clean
make -j4 || exit 1
make install || exit 1
done
source
share