2012-05-14 58 views
3

我想爲Android版本編譯ffmpeg。
但每次嘗試時,我都無法編譯ffmpeg的源代碼。
我認爲我的配置選項可能無效。適用於Android的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),因爲當我輸入「製作」,編譯器不知道哪裏是頭文件(如文件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獅子
的Android NDK版本:Android的NDK-R8

回答

3

我不知道你的配置,但我可以使用腳本從bambuser編譯的ffmpeg(最新版本)下Ubuntu(或在Windows下運行Ubuntu的Oracle VM Virtual Box下)。

+0

我下載了它,它適用於我。 – manutd

1

我在Mac上編譯FFmpeg時遇到了同樣的問題。解決方法是:

編輯config.h(是的,它是由配置生成的)並將所有lrintfriends設置爲1。 例如:#define HAVE_LRINT 1

這將允許構建繼續。

如果您重新運行configure那麼您將需要再次編輯config.h