Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] Im failing to build .so file for android from FFMPEG

Posted on November 14, 2022

Solution 1 :

I recommend building the simplest version using –disable-everything and build up your command from there. I built on mac. I edited your third attempt and built for arm64 with one codec as follows:

    #!/bin/bash
    export ANDROID_NDK_HOME=${HOME}/Library/Android/android-ndk-r21
    export HOST_TAG=darwin-x86_64 # adjust to your building host
    export TOOLCHAIN=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/$HOST_TAG
    
    function build_other
    {
       TARGET_ABI=arm64-v8a
       HOST=aarch64-linux-android
        ./configure --disable-everything --disable-doc --disable-programs --disable-shared --enable-cross-compile --arch=aarch64 --target-os=linux --enable-pic 
            --prefix="$HOME/ffmpeg_build" 
            --sysroot=${ANDROID_NDK_HOME}/sysroot 
            --enable-encoder=h261 --enable-decoder=h261 
            --extra-ldflags="-L${ANDROID_NDK_HOME}/platforms/android-29/arch-arm64/usr/lib -lc" 
            --cc=${TOOLCHAIN}/bin/aarch64-linux-android29-clang --ld=${TOOLCHAIN}/bin/aarch64-linux-android-ld --strip=${TOOLCHAIN}/bin/aarch64-linux-android-strip
        
        make clean
        make
        make install
    }
    
    mkdir $HOME/ffmpeg_build 2> /dev/null 
    build_other
    echo build_arm64-v8a finished

NOTE:
I built on mac, this should work on linux.
Also, do not link pthread! pthread is in libc for android.

Problem :

I tried many times with different versions of ffmpeg but failed eventually. I dont know how they wrote .sh file to configure different tools. Here are some .sh files i tried and it all failed. Either it shows only android/share folder instead of

  • android/include

  • android/lib

  • android/share

OR

i end up in error like no file or folder exist,etc

I will share build_arm64-v8a different version of files below

VERSION 1

#!/bin/bash
export NDK=/media/sf_sharing/android-ndk
export HOST_TAG=linux-x86_64 # adjust to your building host
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG

export CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
export CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++

function build_arm64-v8a
{
  ./configure 
  --prefix=./android/arm64-v8a 
  --enable-static 
  --enable-pic 
  --disable-asm 
  --disable-opencl 
  --disable-cli 
  --host=aarch64-linux 
  --cross-prefix=$TOOLCHAIN/bin/aarch64-linux-android- 
  --sysroot=$TOOLCHAIN/sysroot 

  make clean
  make
  make install
}

build_arm64-v8a
echo build_arm64-v8a finished

VERSION 2

#!/bin/bash

TOOLCHAIN=/media/sf_sharing/my-android-toolchain64
CROSS_PREFIX=$TOOLCHAIN/bin/aarch64-linux-android-
rm -f $(pwd)/compat/strtod.o
function build_one
{
./configure --prefix=$PREFIX --enable-shared --disable-static --enable-protocol=file --enable-pic --enable-small --disable-programs --disable-doc --disable-symver --target-os=android --enable-cross-compile --cross-prefix=$CROSS_PREFIX --extra-cflags="-Os -fpic $ADDI_CFLAGS" --extra-ldflags="$ADDI_LDFLAGS" --sysroot=$TOOLCHAIN/sysroot $ADDITIONAL_CONFIG_FLAG
make clean
make -j2
make install
}

CPU=arm64-v8a
mkdir -p $(pwd)/android/$CPU
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-march=armv8-a"
ADDI_LDFLAGS="-L$TOOLCHAIN/sysroot/usr/lib"
ADDITIONAL_CONFIG_FLAG="--arch=aarch64 --enable-yasm"
build_one

VERSION 3

#!/bin/bash
export NDK=/media/sf_sharing/android-ndk
export HOST_TAG=linux-x86_64 # adjust to your building host
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG

export CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
export CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++

function build_arm64-v8a
{
  ./configure 
  --prefix="$HOME/ffmpeg_build" 
  --pkg-config-flags="--static" 
  --extra-cflags="-I$HOME/ffmpeg_build/include" 
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" 
  --extra-libs="-lpthread -lm" 
  --bindir="$HOME/bin" 
  --enable-gpl 
  --enable-gnutls 
  --enable-libaom 
  --enable-libass 
  --enable-libfdk-aac 
  --enable-libfreetype 
  --enable-libmp3lame 
  --enable-libopus 
  --enable-libvorbis 
  --enable-libvpx 
  --enable-libx264 
  --enable-libx265 
  --enable-nonfree 

  make clean
  make
  make install
}

build_arm64-v8a
echo build_arm64-v8a finished

I’m using

  • ffmpeg-snapshot.tar.bz2

  • android-ndk-r21d-linux-x86_64

READ  [ANSWERED] android - changing Textview dinamically
Powered by Inline Related Posts

the only thing i know in ‘ndk 21` is we need to use default toolchain (android documentation says).

How to create .sh file to build .so file to use in android?

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress