cygwin make errors:ffmpeg用ndk编译

时间:2013-01-07 16:22:39

标签: android-ndk compiler-errors ffmpeg

最近我正在使用ndk为android编译ffmpeg,我这样做是为了这篇文章(http://vec.io/posts/how-to-build-ffmpeg-with-android-ndk)。配置是对的, 但是当我开始制作时,就会出错。 配置shell:

export TMPDIR=D:/temp/android
export NDK=/cygdrive/D/DevelopKit/android-ndk-r8d
export PATH=/cygdrive/C/cygwin/tmp/ffmpeg/bin:$PATH
export CC=arm-linux-androideabi-gcc
export LD=arm-linux-androideabi-ld
export AR=arm-linux-androideabi-ar
export C_INCLUDE_PATH=/cygdrive/C/cygwin/tmp/ffmpeg/sysroot/usr/include
export LIBRARY_PATH=/cygdrive/C/cygwin/tmp/ffmpeg/sysroot/usr/lib
CFLAGS="-O3 -Wall -mthumb -pipe -fpic -fasm \
  -finline-limit=300 -ffast-math \
  -fstrict-aliasing -Werror=strict-aliasing \
  -fmodulo-sched -fmodulo-sched-allow-regmoves \
  -Wno-psabi -Wa,--noexecstack \
  -D__ARM_ARCH_5__ -D__ARM_ARCH_5E__ \
  -D__ARM_ARCH_5T__ -D__ARM_ARCH_5TE__ \
  -DANDROID -DNDEBUG"

EXTRA_CFLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8"

FFMPEG_FLAGS="--prefix=/tmp/ffmpeg/build \
  --target-os=linux \
  --arch=arm \
  --enable-cross-compile \
  --cross-prefix=arm-linux-androideabi- \
  --enable-shared \
  --disable-symver \
  --disable-doc \
  --disable-ffplay \
  --disable-ffmpeg \
  --disable-ffprobe \
  --disable-ffserver \
  --disable-avdevice \
  --disable-avfilter \
  --disable-encoders  \
  --disable-muxers \
  --disable-filters \
  --disable-devices \
  --disable-everything \
  --enable-protocols  \
  --enable-parsers \
  --enable-demuxers \
  --disable-demuxer=sbg \
  --enable-decoders \
  --enable-bsfs \
  --enable-network \
  --enable-swscale  \
  --enable-asm \
  --enable-version3"

./configure $FFMPEG_FLAGS --extra-cflags="$CFLAGS $EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS"

配置结果(config.mak的一部分):

ifndef FFMPEG_CONFIG_MAK
FFMPEG_CONFIG_MAK=1
FFMPEG_CONFIGURATION=--prefix=/tmp/ffmpeg/build --target-os=linux --arch=arm --enable-cross-compile --cross-prefix=arm-linux-androideabi- --enable-shared --disable-symver --disable-doc --disable-ffplay --disable-ffmpeg --disable-ffprobe --disable-ffserver --disable-avdevice --disable-avfilter --disable-encoders --disable-muxers --disable-filters --disable-devices --disable-everything --enable-protocols --enable-parsers --enable-demuxers --disable-demuxer=sbg --enable-decoders --enable-bsfs --enable-network --enable-swscale --enable-asm --enable-version3 --extra-cflags='-O3 -Wall -mthumb -pipe -fpic -fasm   -finline-limit=300 -ffast-math   -fstrict-aliasing -Werror=strict-aliasing   -fmodulo-sched -fmodulo-sched-allow-regmoves   -Wno-psabi -Wa,--noexecstack   -D__ARM_ARCH_5__ -D__ARM_ARCH_5E__   -D__ARM_ARCH_5T__ -D__ARM_ARCH_5TE__   -DANDROID -DNDEBUG -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad' --extra-ldflags='-Wl,--fix-cortex-a8'
prefix=/tmp/ffmpeg/build
LIBDIR=$(DESTDIR)${prefix}/lib
SHLIBDIR=$(DESTDIR)${prefix}/lib
INCDIR=$(DESTDIR)${prefix}/include
BINDIR=$(DESTDIR)${prefix}/bin
DATADIR=$(DESTDIR)${prefix}/share/ffmpeg
MANDIR=$(DESTDIR)${prefix}/share/man
SRC_PATH=.
ifndef MAIN_MAKEFILE
SRC_PATH:=$(SRC_PATH:.%=..%)
endif
CC_IDENT=gcc 4.6
 (GCC)
ARCH=arm
CC=arm-linux-androideabi-gcc
CXX=arm-linux-androideabi-g++
AS=arm-linux-androideabi-gcc
LD=arm-linux-androideabi-gcc
DEPCC=arm-linux-androideabi-gcc
DEPCCFLAGS= $(CPPFLAGS)
DEPAS=arm-linux-androideabi-gcc
DEPASFLAGS= $(CPPFLAGS)
YASM=yasm
DEPYASM=yasm
AR=arm-linux-androideabi-ar
ARFLAGS=rc
AR_O=$@

但是当我做到了

CC  libavformat/4xm.o
In file included from ./libavutil/bswap.h:35:0,
                 from ./libavutil/intreadwrite.h:25,
                 from libavformat/4xm.c:30:
./config.h:8:18: warning: missing terminating " character [enabled by default]
In file included from ./libavutil/bswap.h:35:0,
                 from ./libavutil/intreadwrite.h:25,
                 from libavformat/4xm.c:30:
./config.h:9:7: warning: missing terminating " character [enabled by default]
./config.h:9:2: error: missing terminating " character
In file included from ./libavutil/intreadwrite.h:25:0,
                 from libavformat/4xm.c:30:
./libavutil/bswap.h:58:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'static'
common.mak:48: recipe for target `libavformat/4xm.o' failed
make: *** [libavformat/4xm.o] Error 1

这是字符错误,我猜它是windows字符(我正在使用cygwin),我尝试了dos2unix但它没有用。请帮助我,谢谢你的建议。

1 个答案:

答案 0 :(得分:2)

编辑./config.h并删除

中的换行符
#define CC_IDENT "gcc 4.6 (GCC)"