2

I have made ffmpeg build with following build script. https://github.com/Free-Syj/ffmpeg-build-script/blob/master/build-android-ffmpeg.sh

It worked for armv7.
when I tried to make for arm64 architecture, it gave me following error.

NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-gcc is unable to create an executable file.

Edited: -

Following build script has been used to make the build.

NDK=/Users/tapansodha/Documents/Softwares/AndroidStudio/adt-bundle-mac-x86_64-20140702/android-ndk-r10e
function build_one
{
./configure --target-os=linux \
--prefix=$PREFIX \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=arm \
--cc=$CC \
--cross-prefix=$PREBUILT/bin/aarch64-linux-android- \
--nm=$NM \
--sysroot=$PLATFORM \
--extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
--enable-shared \
--disable-static \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--disable-everything \
--disable-debug \
--disable-programs \
--disable-doc \
--enable-decoder=h264 \
--enable-decoder=mjpeg \
--enable-decoder=mpeg4 \
--enable-decoder=mxpeg \
--enable-decoder=aac \
$ADDITIONAL_CONFIGURE_FLAG

make clean
make  -j4 install
}

#arm arm64-v8a
PLATFORM=$NDK/platforms/android-21/arch-arm64/
PREBUILT=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64
CC=$PREBUILT/bin/aarch64-linux-android-gcc
NM=$PREBUILT/bin/aarch64-linux-android-nm
CPU=arm64
PREFIX=./android_arm64n/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one

2 Answers2

0

Step one should be to upgrade your NDK. aarch64 was very new when r10e was released and the compilers have likely improved for that target since then.

Second, when it comes to autoconf projects, you'll probably have a much easier time using the NDK's built in standalone toolchains rather than trying to rig one up yourself.

$ $NDK/build/tools/make_standalone_toolchain.py \
    --arch arm64 --install-dir my-toolchain
$ my-toolchain/bin/clang++ foo.cpp

The above will just work as a cross compiler. No need to deal with --sysroot, -gcc-toolchain, or any of that yourself.

Dan Albert
  • 10,079
  • 2
  • 36
  • 79
0

Try changing --arch=arm to --arch=aarch64

RainYang
  • 21
  • 3