3

我想为 Android 版本编译 ffmpeg。
但是每次我尝试,我都无法编译ffmpeg的源代码。
我认为我的配置选项可能无效。

我使用这个脚本进行配置。

#!/bin/sh
NDK_PATH=$HOME/android-ndk-r8
PREBUILT=$NDK_PATH/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86

LDFLAGS="-Wl,-T,$PREBUILT/armelf_linux_eabi.x -Wl,-rpath-link=$NDK_PATH/platforms/android-8/arch-arm/usr/lib \
     -L$NDK_PATH/platforms/android-8/arch-arm/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o \
     $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl"
COMMON_CONFIG="\
          ./configure --target-os=linux \
          --arch=arm \
          --enable-cross-compile \
          --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
          --as=$PREBUILT/bin/arm-linux-androideabi-gcc \
          --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
          --sysinclude=$NDK_PATH/platforms/android-8/arch-arm/usr/include \
          --nm=$PREBUILT/bin/arm-linux-androideabi-nm \
          --extra-ldflags=\"$LDFLAGS\" \
          --extra-cflags=-I$NDK_PATH/platforms/android-8/arch-arm/usr/include \

eval "$COMMON_CONFIG"
if [ $? -ne 0 ]; then
  exit 1
fi

我必须给编译器一个新的头文件路径(通过--extra-cflags),因为当我输入'make'时,编译器不知道头文件在哪里(比如math.h,ctime.h)

使用此脚本配置并键入“make”后,我收到了这些错误。

CC  libavdevice/alldevices.o
In file included from /Users/gyeongmingim/android-ndk-r8/platforms/android-8/arch-arm/usr/include/stdlib.h:42,
             from ./libavutil/common.h:35,
             from ./libavutil/avutil.h:126,
             from libavdevice/avdevice.h:22,
             from libavdevice/alldevices.c:22:
/Users/gyeongmingim/android-ndk-r8/platforms/android-8/arch-arm/usr/include/strings.h:49: warning: redundant redeclaration of 'index'
/Users/gyeongmingim/android-ndk-r8/platforms/android-8/arch-arm/usr/include/string.h:47: note: previous declaration of 'index' was here
/Users/gyeongmingim/android-ndk-r8/platforms/android-8/arch-arm/usr/include/strings.h:50: warning: redundant redeclaration of 'strcasecmp'
/Users/gyeongmingim/android-ndk-r8/platforms/android-8/arch-arm/usr/include/string.h:57: note: previous declaration of 'strcasecmp' was here
/Users/gyeongmingim/android-ndk-r8/platforms/android-8/arch-arm/usr/include/strings.h:51: warning: redundant redeclaration of 'strncasecmp'
/Users/gyeongmingim/android-ndk-r8/platforms/android-8/arch-arm/usr/include/string.h:58: note: previous declaration of 'strncasecmp' was here
In file included from ./libavutil/internal.h:178,
             from ./libavutil/common.h:342,
             from ./libavutil/avutil.h:126,
             from libavdevice/avdevice.h:22,
             from libavdevice/alldevices.c:22:
./libavutil/libm.h:62: error: static declaration of 'lrint' follows non-static declaration
./libavutil/libm.h:69: error: static declaration of 'lrintf' follows non-static declaration
./libavutil/libm.h:76: error: static declaration of 'round' follows non-static declaration
./libavutil/libm.h:90: error: static declaration of 'trunc' follows non-static declaration
make: *** [libavdevice/alldevices.o] Error 1

有什么问题?
我的配置有错误的信息吗?或任何丢失的标志?

操作系统:Mac Lion
Android-ndk 版本:android-ndk-r8

4

2 回答 2

3

我不知道您的配置,但我能够在 Ubuntu 下(或在 Windows 下运行 Ubuntu 的 Oracle VM Virtual Box 下)使用来自bambuser(最新版本)的脚本编译 FFMPEg。

于 2012-05-14T13:54:50.510 回答
2

我在 Mac 上编译 FFmpeg 时遇到了同样的问题。解决方法是:

编辑config.h(是的,它是由配置生成的)并将所有lrint和设置friends1. 例如:#define HAVE_LRINT 1

这将允许构建继续。

如果重新运行configure,则需要config.h再次进行编辑。

于 2013-08-11T16:27:02.327 回答