arm-linux-androideabi-gcc无法创建可执行文件 - 为android armeabi设备编译ffmpeg [英] arm-linux-androideabi-gcc is unable to create an executable - compile ffmpeg for android armeabi devices
问题描述
我正在为android armeabi设备编译ffmpeg。
我正在按照 roman10.net的教程
他给定的构建脚本为armv7-a设备构建ffmpeg。我想为armeabi构建它。
I am trying to compile ffmpeg for android armeabi devices.
I am following tutorial by roman10.net
His given build script builds ffmpeg for armv7-a devices. I want to build it for armeabi.
我的最终目标是在android armeabi和armv7-a设备上运行ffmpeg命令。
所以我从
#arm v7vfpv3
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one
到
#arm v6
CPU=armv6
OPTIMIZE_CFLAGS="-marm -march=$CPU"
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one
(我以为将其更改为armv6会构建与armeabi设备兼容的ffmpeg m我错误?)
(I thought changing it to armv6 would build ffmpeg compatible with armeabi devices. m I wrong?)
疑问1:
我还要更改工具链吗?
即从 arm-linux-androideabi-4.4.3 到 arm-eabi-4.4.0
疑问2:
当我尝试ru nning ./build.sh(不改变工具链)它给我以下错误:
When I try running ./build.sh (without changing toolchain) it gives me following error:
/home/chaitanya/android/android-ndk-r5b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc is unable to create an executable file.
C compiler test failed.
If you think configure made a mistake,.. blaah blahh blaah
之后,我收到了很多警告,指出:
'sub_id'已被弃用,许多其他功能已被废止。
after that I got lot of warnings saying:
‘sub_id’ is deprecated and many other function deprecated warnings.
strong>:ubuntu 11.10
ffmpeg version :0.11.2
NDK :android-ndk-r5b
platform: ubuntu 11.10
ffmpeg version: 0.11.2
NDK : android-ndk-r5b
这是我的构建脚本:
#!/bin/bash
######################################################
# Usage:
# put this script in top of FFmpeg source tree
# ./build_android
# It generates binary for following architectures:
# ARMv6
# ARMv6+VFP
# ARMv7+VFPv3-d16 (Tegra2)
# ARMv7+Neon (Cortex-A8)
# Customizing:
# 1. Feel free to change ./configure parameters for more features
# 2. To adapt other ARM variants
# set $CPU and $OPTIMIZE_CFLAGS
# call build_one
######################################################
NDK=~/android/android-ndk-r5b
PLATFORM=$NDK/platforms/android-8/arch-arm/
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
function build_one
{
./configure --target-os=linux \
--prefix=$PREFIX \
--enable-cross-compile \
--extra-libs="-lgcc" \
--arch=arm \
#--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
#--nm=$PREBUILT/bin/arm-linux-androideabi-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 " \
--disable-shared \
--enable-static \
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
--disable-everything \
--enable-demuxer=mov \
--enable-demuxer=h264 \
--disable-ffplay \
--enable-protocol=file \
--enable-avformat \
--enable-avcodec \
--enable-decoder=rawvideo \
--enable-decoder=mjpeg \
--enable-decoder=h263 \
--enable-decoder=mpeg4 \
--enable-decoder=h264 \
--enable-parser=h264 \
--disable-network \
--enable-zlib \
--disable-avfilter \
--disable-avdevice \
$ADDITIONAL_CONFIGURE_FLAG
make clean
make -j4 install
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
}
#arm v6
CPU=armv6
OPTIMIZE_CFLAGS="-marm -march=$CPU"
PREFIX=./android/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one
#arm v7vfpv3
#CPU=armv7-a
#OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
#PREFIX=./android/$CPU
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
#arm v7vfp
#CPU=armv7-a
#OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU "
#PREFIX=./android/$CPU-vfp
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
#arm v7n
#CPU=armv7-a
#OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -march=$CPU -mtune=cortex-a8"
#PREFIX=./android/$CPU
#ADDITIONAL_CONFIGURE_FLAG=--enable-neon
#build_one
#arm v6+vfp
#CPU=armv6
#OPTIMIZE_CFLAGS="-DCMP_HAVE_VFP -mfloat-abi=softfp -mfpu=vfp -marm -march=$CPU"
#PREFIX=./android/${CPU}_vfp
#ADDITIONAL_CONFIGURE_FLAG=
#build_one
解决这个问题?发生什么问题?
How do I tackle this problem? what is going wrong?
推荐答案
我不知道这是你正在看的,但是我创建了一个脚本,以便为Android构建FFmpeg 0.11.1。我修改了旧版Bambuser FFmpeg版本提供的脚本,以使它们与0.11.1一起使用。我正在使用这个脚本在我自己的应用程序中构建FFmpeg,所以我知道构建工作。该脚本位于 http://servestream.sourceforge.net/build-ffmpeg.sh 。我正在使用android-ndk-r8b和Ubuntu 12.04(x64)进行构建。为了使用脚本,请执行以下操作:
I'm not sure if this is what you are looking but I created a script in order to build FFmpeg 0.11.1 for Android. I modified the scripts provided with older Bambuser FFmpeg builds in order to get them working with 0.11.1. I'm currently using this script to build FFmpeg in my own application so I know the build works. The script located at http://servestream.sourceforge.net/build-ffmpeg.sh. I'm using android-ndk-r8b and Ubuntu 12.04 (x64) to do the building. In order to use the script do the following:
1。)下载脚本
2.)打开脚本并将PACKAGE变量修改为匹配应用程序的包
3.)使其可执行:chmod + x build-ffmpeg.sh
4.)设置脚本使用的NDK变量,例如:export NDK = / home / user / android-ndk-r8b
5.)运行脚本:./build-ffmpeg.sh
1.) Download the script
2.) Open the script and modify the PACKAGE variable to match application's package
3.) Make it executable: chmod +x build-ffmpeg.sh
4.) Set the NDK variable used by the script, for example: export NDK=/home/user/android-ndk-r8b
5.) Run the script: ./build-ffmpeg.sh
编译的二进制文件将位于当前工作目录中新创建的final-builds文件夹中。 (注意:脚本为armeabi,armeabi-v7a和x86架构构建二进制文件)
The compiled binaries will be located in the newly created "final-builds" folder in the current working directory. (Note: the script builds binaries for armeabi, armeabi-v7a and x86 architectures)
我希望这可以回答您的问题。
I hope this answers your question.
更新:
如果没有找到脚本, http://sourceforge.net/p/servestream/code/HEAD/tree/ffmpeg/scripts/arm-build。 sh
这篇关于arm-linux-androideabi-gcc无法创建可执行文件 - 为android armeabi设备编译ffmpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!