FFMPEG android编译错误

时间:2014-03-16 05:09:46

标签: android android-ndk ffmpeg makefile

我正在尝试使用ndk为android编译ffmpeg。 os:ubuntu 13.10。我按照this教程。但是当我运行build_android.sh时,它会给我以下错误 -

sujith@Vaio:~$ cd /home/sujith/ndk9d/sources/ffmpeg
sujith@Vaio:~/ndk9d/sources/ffmpeg$ sudo chmod +x build_android.sh
[sudo] password for sujith: 
sujith@Vaio:~/ndk9d/sources/ffmpeg$ ./build_android.sh
/home/sujith/sujith/ndk9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-         x86_64/bin/arm-linux-androideabi-gcc is unable to create an executable file.
C compiler test failed.

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.
Makefile:2: config.mak: No such file or directory
Makefile:53: /common.mak: No such file or directory
Makefile:93: /libavutil/Makefile: No such file or directory
Makefile:93: /library.mak: No such file or directory
Makefile:95: /doc/Makefile: No such file or directory
Makefile:178: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'.  Stop.
Makefile:2: config.mak: No such file or directory
Makefile:53: /common.mak: No such file or directory
Makefile:93: /libavutil/Makefile: No such file or directory
Makefile:93: /library.mak: No such file or directory
Makefile:95: /doc/Makefile: No such file or directory
Makefile:178: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'.  Stop.
Makefile:2: config.mak: No such file or directory
Makefile:53: /common.mak: No such file or directory
Makefile:93: /libavutil/Makefile: No such file or directory
Makefile:93: /library.mak: No such file or directory
Makefile:95: /doc/Makefile: No such file or directory
Makefile:178: /tests/Makefile: No such file or directory
make: *** No rule to make target `/tests/Makefile'.  Stop.

这是我的build_android.sh

#!/bin/bash
NDK=$HOME/sujith/ndk9d
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-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)/android/$CPU 
ADDI_CFLAGS="-marm"
build_one

我的build_android.sh位于ffmpeg源根目录中。 怎么解决这个问题?请帮帮我..

2 个答案:

答案 0 :(得分:1)

看起来,NDK=$HOME/sujith/ndk9d是错误的。它可能应该阅读

NDK=$HOME/ndk9d

答案 1 :(得分:0)

I had the same problem , and i dig into it and found that.
#!/bin/bash
NDK=$HOME/sujith/ndk9d
SYSROOT=$NDK/platforms/android-9/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64

Step 1  : Verify all the above path. 
Step 2 :  Remove all the escape sequence and carriage return like below

#!/bin/bash

NDK=$HOME/FFMPEG/android-ndk/

SYSROOT=$NDK/platforms/android-24/arch-arm/

TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-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)/android/work

ADDI_CFLAGS="-marm"

build_one




Step 3 : As i can see in the your terminal 
sujith@Vaio:~/ndk9d/sources/ffmpeg , you have kept the code in here . 
But i have copied the source code directly in folder sources/ 
I didn't put the code inside any other folder. ./Configure file and build_android.sh are present in the sources/ folder with libavcodec etc folder and code. 

Please try this and let me know if it solves your problem