[FFmpeg-user] ffplay cross-compilation

Vladimir Kondenko kondenko2011 at gmail.com
Mon Feb 5 16:46:43 EET 2018


Hello.
I'm trying to obtain an ffplay binary to use it in my Android app. But when
I run my configure script, it says that sdl2 in not found although I
cross-compiled it too and put its headers and library flags to
--extra-cflags and --extraldflags. If I remove --enable-sdl2 ffplay simply
wont appear in the list of the programs to be built.
I managed to get it to compile on release/3.2 branch, but it throws an
error regarding an undefined reference to 'main' in ether ffplay or
libavutil.so files (depending on shared and/or static flags).
Then I edited sdl2_cflags and sdl2_extralibs variables in the configure
file on the master branch to point to my library, but it won't compile
anyway.
What am I doing wrong?

My configure file has been changed this way:

if enabled sdl2; then
    sdl2_cflags="-I/home/kondenko/Android/ffmpeg/ffmpeg/sdl2/include
-D_REENTRANT"

sdl2_extralibs="-L/home/kondenko/Android/ffmpeg/ffmpeg/sdl2/build/android/obj/local/armeabi-v7a
-lSDL2"
    enable sdl2
fi

And here's my script:

make_or_die() {
    make -j $(nproc) || exit
    sudo make install || exit
}

ARCH=arm
API=17
CPU=armv7

WORKING_DIR=~/Android/ffmpeg/ffmpeg

NDK=~/Android/SDK/ndk
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi
SYSROOT=$TOOLCHAIN/sysroot
CROSS_PREFIX=$TOOLCHAIN/bin/arm-linux-androideabi-

FFMPEG_PREFIX=$(pwd)/android/$CPU

SDL=$(pwd)/sdl2
SDL_PREFIX=$SDL/build/android/obj/local/armeabi-v7a

export PATH=$PATH:$TOOLCHAIN/bin:$TOOLCHAIN/include
export CC="arm-linux-androideabi-clang"
export CXX="arm-linux-androideabi-clang++"

build_sdl2() {
    hg clone https://hg.libsdl.org/SDL $SDL
    cd $SDL
    sudo ./build-scripts/androidbuildlibs.sh
    cd $WORKING_DIR
    echo "SDL build folder: $SDL_PREFIX"
}

build_ffmpeg() {
    sudo make distclean
    sudo ./configure \
        --target-os=android \
        --arch=$ARCH \
        --prefix=$FFMPEG_PREFIX \
        --cross-prefix=$CROSS_PREFIX \
        --enable-static \
        --disable-ffprobe \
        --disable-ffmpeg \
        --disable-doc \
        --disable-symver \
        && make_or_die && header "Success! Your files are at
$FFMPEG_PREFIX" \
        || (echo \\n && tail ffbuild/config.log && exit)
}

build_sdl2
build_ffmpeg


More information about the ffmpeg-user mailing list