Jeffery Ma
Jeffery Ma

Reputation: 3341

osx build ffmpeg for android

I want to build ffmpeg source code for android platform.

And i had followed some tutorials, but build failed.

here are my configs

  1. build_android.sh file

    #!/bin/bash
    NDK=/Users/***/Library/Android/ndk/android-ndk-r14b
    SYSROOT=$NDK/platforms/android-19/arch-arm/
    TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
    function build_one
    {
        ./configure 
        --prefix=$PREFIX 
        --enable-shared 
        --disable-static 
        --disable-doc 
        --disable-ffmpeg 
        --disable-ffplay 
        --disable-ffprobe 
        --disable-ffserver 
        --disable-avdevice 
        --disable-doc
        --disable-symver 
        --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- 
        --target-os=linux 
        --arch=arm 
        --enable-cross-compile 
        --sysroot=$SYSROOT 
        --extra-cflags="-Os -fpic $ADDI_CFLAGS" 
        --extra-ldflags="$ADDI_LDFLAGS" 
        $ADDITIONAL_CONFIGURE_FLAG
        make clean
        make
        make install
    }
    CPU=arm
    PREFIX=$(pwd)/androidtest/$CPU
    ADDI_CFLAGS="-marm"
    build_one
    
  2. configure file

    I have also changed configure file

change

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_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'  
LIB_INSTALL_EXTRA_CMD='$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"'  
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'  
SLIB_INSTALL_LINKS='$(SLIBNAME)'
  1. console output
...
INSTALL   doc/examples/demuxing_decoding.c
INSTALL   doc/examples/encode_audio.c
INSTALL   doc/examples/encode_video.c
INSTALL   doc/examples/extract_mvs.c
INSTALL   doc/examples/filter_audio.c
INSTALL   doc/examples/filtering_audio.c
INSTALL   doc/examples/filtering_video.c
INSTALL   doc/examples/http_multiclient.c
INSTALL   doc/examples/hw_decode.c
INSTALL   doc/examples/metadata.c
INSTALL   doc/examples/muxing.c
INSTALL   doc/examples/qsvdec.c
INSTALL   doc/examples/remuxing.c
INSTALL   doc/examples/resampling_audio.c
INSTALL   doc/examples/scaling_video.c
INSTALL   doc/examples/transcode_aac.c
INSTALL   doc/examples/transcoding.c
INSTALL   doc/examples/vaapi_encode.c
INSTALL   doc/examples/vaapi_transcode.c
INSTALL   doc/examples/README
INSTALL   doc/examples/Makefile
INSTALL   libavdevice/libavdevice.a
/bin/sh: ranlib/usr/local/lib/libavdevice.a: No such file or directory
make: *** [install-libavdevice-static] Error 127
  1. problem

according to the console output, libavdevice.a not found.

enter image description here

but I can find it in the finder

how to fix /bin/sh: ranlib/usr/local/lib/libavdevice.a: No such file or directory error ?

i have searched some resolvers for make: *** [install-libavdevice-static] Error 127 but not work for me.

Upvotes: 1

Views: 658

Answers (2)

CharlesYale
CharlesYale

Reputation: 41

enter image description here

Look at your configure file to see if a space is missing. If so then make '$$(RANLIB)"$(LIBDIR)/$(LIBNAME)"' -> '$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'

Upvotes: 0

Kiven
Kiven

Reputation: 11

I also encountered the same problem. Although it was solved, I still don't know the exact reason. I encountered this error when using the NDK that was downloaded in Android Studio and ffmpeg 4.0. The solution was to replace ffmepg with the 3.3.7 version and re-download the r14 version of ndk instead of using the one provided in Android studio. Hope this is useful to you. ndk下载链接

Upvotes: 1

Related Questions