How can I get FFmpeg to find installed libraries when -sysroot points to another directory?

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
# Expand the prebuilt/* path into the correct one
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

# 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/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"
                    # Runtime choosing neon vs non-neon requires
                    # renamed files
                    ABI="armeabi-v7a"
                    ;;
                armv7a)
                    # I have tried many things here.
                    EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp"
                    EXTRA_LDFLAGS=""
                    ABI="armeabi-v7a"
                    ;;
                *)
                    # I have tried many things here.
                    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
+5
source share
2 answers

, , libmp3lame, "make install" , script. ECHO, , PATH/CFLAGS/LDFLAGS , , , .

+1

, , http://bambuser.com/opensource

:

  • lame android https://github.com/intervigilium/liblame
  • diff build.sh "bambuser.com" , :

    3c3,6
    <  export NDK=${HOME}/downloads/android-ndk # r8d
    ---
    > if [ "$NDK" = "" ]; then
    >     echo NDK variable not set, assuming ${HOME}/android-ndk
    >     export NDK=${HOME}/android-ndk
    > fi
    15,16c18
    < #for version in armv5te armv7a; do
    <  for version in         armv7a; do
    ---
    > for version in armv5te armv7a; do
    24c26
    <     FLAGS="$FLAGS --disable-everything --enable-libmp3lame"
    ---
    >     FLAGS="$FLAGS --disable-everything"
    
  • "intervigilium" liblame/jni/lame PATH_TO_NDK/platforms/android-3/arch-arm/usr/include

  • "intervigilium" liblame/libs/armeabi-v7a/liblame.so PATH_TO_NDK/platforms/android-3/arch-arm/usr/libs RENAME libmp3lame.so.
  • build.sh.
  • :

    install prefix            ../build/ffmpeg/armeabi-v7a
    source path               /home/samuele/downloads/ffmpeg/ffmpeg-android/ffmpeg
    C compiler                arm-linux-androideabi-gcc
    ARCH                      arm (generic)
    big-endian                no
    runtime cpu detection     no
    ARMv5TE enabled           yes
    ARMv6 enabled             yes
    ARMv6T2 enabled           yes
    ARM VFP enabled           yes
    IWMMXT enabled            no
    NEON enabled              no
    debug symbols             yes
    strip symbols             yes
    optimizations             small
    static                    yes
    shared                    yes
    postprocessing support    no
    new filter support        yes
    network support           yes
    threading support         pthreads
    SDL support               no
    Sun medialib support      no
    AVISynth enabled          no
    frei0r enabled            no
    libdc1394 support         no
    libdirac enabled          no
    libfaac enabled           no
    libgsm enabled            no
    **libmp3lame enabled        yes**
    libnut enabled            no
    libopencore-amrnb support no
    libopencore-amrwb support no
    libopencv support         no
    libopenjpeg enabled       no
    librtmp enabled           no
    libschroedinger enabled   no
    libspeex enabled          no
    libtheora enabled         no
    libvorbis enabled         no
    libvpx enabled            no
    libx264 enabled           no
    libxavs enabled           no
    libxvid enabled           no
    zlib enabled              no
    bzlib enabled             no
    
    Enabled decoders:
    
    Enabled encoders:
    mpeg2video      nellymoser
    
    Enabled hwaccels:
    
    Enabled parsers:
    
    Enabled demuxers:
    
    Enabled muxers:
    
    Enabled protocols:
    
    Enabled filters:
    buffer
    
    Enabled bsfs:
    
    Enabled indevs:
    
    Enabled outdevs:
    
    License: LGPL version 2.1 or later
    Creating config.mak and config.h...
    libavutil/avconfig.h is unchanged
    

, FFmpeg-. , ...;)

EDIT: --disable-everything, , , .., ~ 40 build dir.

+1

All Articles