晓Lee
晓Lee

Reputation: 1

The Android build FFMPEG encounter problems

I write an Android test App on Ubuntu, the NDK - BUILD, appeared

/ home/lee/Work/Android/the NDK/Android - the NDK - r10e toolchains/arm - Linux - androideabi - 4.8 / prebuilt/Linux - x86_64 / bin /../ lib/GCC/arm - Linux - androideabi / 4.8 /../../../../ arm - Linux - androideabi/bin/ld: error: always find - lGLESv2 Collect2: error: ld returned 1 exit status Make: * * * [obj/local/armeabi/libffmpeg so] Error 1

FFmpeg is version 3.1.4,and the NDK version is r10e

Upvotes: 0

Views: 79

Answers (1)

WLGfx
WLGfx

Reputation: 1179

This works with 3.1.4 although it doesn't build a single library.

#!/bin/bash

NDK=$HOME/Android/Sdk/ndk-bundle
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
CPREFIX=$TOOLCHAIN/bin/arm-linux-androideabi-

function build_it {
./configure \
    --prefix=$PREFIX    \
    --disable-static    \
    --enable-shared     \
    --disable-doc       \
    --disable-ffmpeg    \
    --disable-ffplay    \
    --disable-ffprobe   \
    --disable-ffserver  \
    --disable-avdevice  \
    --disable-doc       \
    --disable-symver    \
    --cross-prefix=$CPREFIX \
    --target-os=linux   \
    --arch=arm      \
    --enable-cross-compile  \
    --enable-gpl        \
    --sysroot=$SYSROOT  \
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
    --extra-ldflags="$ADDI_LDFLAGS" \
    $ADDITIONAL_CONFIGURE_FLAG
    make clean
    make -j9
    make install
}

CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"

Building a single library is more trouble than it's worth, just ensure you load the libraries in the correct order:

avutil, avcodec, avformat, swscale, swresample, postproc

Also, to get the libraries to build with the correct version numbers change these lines in the ./configure file

from

SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'

to

SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS='$(SLIBNAME)'

EDIT:

The issue you're having with regards to GLES, can you show more info?

Upvotes: 0

Related Questions