ffmpeg编译时的错误

时间:2012-03-16 14:20:44

标签: android android-ndk ffmpeg cygwin

我试图通过以下脚本编译ffmpeg,但编译时遇到错误:(使用Windows 7 - android ndk 7rb和cygwin)

s@s-PC /cygdrive/f/export/ffmpeg-0.8.10
$ ./setup.sh
F:/Compiler/android-ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/wind                                                                                                    ows/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.
./setup.sh: line 48: --extra-cflags=: command not found
./setup.sh: line 51: --extra-ldflags=: command not found
./setup.sh: line 53: --extra-ldflags=: command not found
Makefile:1: config.mak: No such file or directory
libavutil/Makefile:1: libavutil/../config.mak: No such file or directory
libavutil/../subdir.mak:96: warning: overriding recipe for target `libavutil/'
libavutil/../subdir.mak:26: warning: ignoring old recipe for target `libavutil/'
libavutil/../subdir.mak:96: warning: overriding recipe for target `libavutil/'
libavutil/../subdir.mak:96: warning: ignoring old recipe for target `libavutil/'
Makefile:239: /tests/fate.mak: No such file or directory
Makefile:240: /tests/fate2.mak: No such file or directory
Makefile:242: /tests/fate/aac.mak: No such file or directory
Makefile:243: /tests/fate/als.mak: No such file or directory
Makefile:244: /tests/fate/fft.mak: No such file or directory
Makefile:245: /tests/fate/h264.mak: No such file or directory
Makefile:246: /tests/fate/mp3.mak: No such file or directory
Makefile:247: /tests/fate/vorbis.mak: No such file or directory
Makefile:248: /tests/fate/vp8.mak: No such file or directory
make: *** No rule to make target `/tests/fate/vp8.mak'.  Stop.
Makefile:1: config.mak: No such file or directory
libavutil/Makefile:1: libavutil/../config.mak: No such file or directory
libavutil/../subdir.mak:96: warning: overriding recipe for target `libavutil/'
libavutil/../subdir.mak:26: warning: ignoring old recipe for target `libavutil/'
libavutil/../subdir.mak:96: warning: overriding recipe for target `libavutil/'
libavutil/../subdir.mak:96: warning: ignoring old recipe for target `libavutil/'
Makefile:239: /tests/fate.mak: No such file or directory
Makefile:240: /tests/fate2.mak: No such file or directory
Makefile:242: /tests/fate/aac.mak: No such file or directory
Makefile:243: /tests/fate/als.mak: No such file or directory
Makefile:244: /tests/fate/fft.mak: No such file or directory
Makefile:245: /tests/fate/h264.mak: No such file or directory
Makefile:246: /tests/fate/mp3.mak: No such file or directory
Makefile:247: /tests/fate/vorbis.mak: No such file or directory
Makefile:248: /tests/fate/vp8.mak: No such file or directory
make: *** No rule to make target `/tests/fate/vp8.mak'.  Stop.

这是我的剧本:

    #!/bin/bash

    export TMPDIR=C:/cygwin/tmp

    ANDROID_API=android-8
    export ANDROID_NDK=F:/Compiler/android-ndk-r7b
    export ANDROID_SDK=F:/Compiler/android-sdk
    SYSROOT=$ANDROID_NDK/platforms/$ANDROID_API/arch-arm
    ANDROID_BIN=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin
    CROSS_COMPILE=${ANDROID_BIN}/arm-linux-androideabi-
    export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools

    export ARM_ROOT=$ANDROID_NDK
    export ARM_INC=$ARM_ROOT/platforms/android-5/arch-arm/usr/include
    export ARM_LIB=$ARM_ROOT/platforms/android-5/arch-arm/usr/lib
    export LIB_INC=${HOME}/include
    export LIB_LIB=${HOME}/lib


    CFLAGS=" -I$ARM_INC -fPIC -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID  -Wa,--noexecstack -MMD -MP "
    LDFLAGS=" -nostdlib -Bdynamic  -Wl,--no-undefined -Wl,-z,noexecstack  -Wl,-z,nocopyreloc -Wl,-soname,/system/lib/libz.so -Wl,-rpath-link=$ARM_LIB,-dynamic-linker=/system/bin/linker -L$ARM_LIB -nostdlib $ARM_LIB/crtbegin_dynamic.o $ARM_LIB/crtend_android.o -lc -lm -ldl -lgcc "

    FLAGS="--target-os=linux 
    --enable-cross-compile 
    --cross-prefix=$CROSS_COMPILE 
    --arch=arm --prefix=$HOME 
    --disable-shared 
    --enable-static 
    --extra-libs=-static 
    --extra-cflags=--static 
    --enable-small 
    --disable-asm 
    --disable-yasm 
    --disable-amd3dnow 
    --disable-amd3dnowext 
    --disable-mmx 
    --disable-mmx2 
    --disable-sse 
    --disable-ssse3 
    --disable-indevs"


    export CFLAGS=$EXTRA_CFLAGS
    export LDFLAGS=$EXTRA_LDFLAGS


./configure $FLAGS 
--extra-cflags="$CFLAGS" 
--extra-ldflags="$LDFLAGS" \
--cc="${CROSS_COMPILE}gcc 
--sysroot=${SYSROOT}" 
--extra-ldflags="$LDFLAGS" \
--cxx="${CROSS_COMPILE}g++ --sysroot=${SYSROOT}" \
--nm="${CROSS_COMPILE}nm" \
--ar="${CROSS_COMPILE}ar"


make clean
make -j4 || exit 1
make install || exit 1

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

您没有转义./configure行(以及以下某些行)的换行符,因此标​​志被视为命令而不是标志。显然--extra-cflags不是一个有效的命令,缺少这些标志也会使配置失败。