2011-08-10 31 views
2

我一直試圖建立ffmpeg在我能想到的每一種可能的方式。我正在嘗試從他們的git倉庫中獲得最新的修訂版本,並且使用了一個構建腳本,我已經確認它可以正常工作,它來自這個問題:iPhone SDK 4.3 libav compiling problem。劇本昨天更新了,顯然對問題中的人有用。失敗的建設ffmpeg爲armv6-7

我的問題是它不會爲armv6和armv7生成.a文件(或者實際上是任何文件)。並且因此命令將其連接到通用庫中失敗。我一直在使用構建腳本也試圖從iFrameExtractor沒有它也失敗,到底脂命令的任何成功,我得到如下:

lipo: can't open input file: ./compiled/armv6/lib/libavcodec.a (No such file or directory) 
lipo: can't open input file: ./compiled/armv6/lib/libavdevice.a (No such file or directory) 
lipo: can't open input file: ./compiled/armv6/lib/libavfilter.a (No such file or directory) 
lipo: can't open input file: ./compiled/armv6/lib/libavformat.a (No such file or directory) 
lipo: can't open input file: ./compiled/armv6/lib/libavutil.a (No such file or directory) 
lipo: can't open input file: ./compiled/armv6/lib/libpostproc.a (No such file or directory) 
lipo: can't open input file: ./compiled/armv6/lib/libswscale.a (No such file or directory) 

,我也貼在整個輸出here如果任何人有任何想法要尋找什麼,在那裏(因爲我不知道從哪裏開始輸出,它幾乎5000行)。 我還要提到的,我是編譯它ARMv6的的ARMv7I386。我想在XCode中導入它以從視頻源獲取H.264幀。

當我嘗試建立的ARMv6我用下面的配置:

./configure \ 
--enable-cross-compile \ 
--arch=arm \ 
--extra-cflags='-arch armv6' \ 
--extra-ldflags='-arch armv6' \ 
--target-os=darwin \ 
--cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ 
--sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk \ 
--cpu=arm1176jzf-s \ 
--extra-ldflags=-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/system \ 
--prefix=compiled/armv6 

,並得到下面的輸出:

/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/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 
[email protected] 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. 

這樣的問題,我應該用什麼C編譯器?我已經嘗試過不同的: 臂蘋果darwin10-GCC-4.2.1 臂蘋果darwin10-LLVM-GCC-4.2 GCC

但具有相同的結果。 gcc適用於i386和armv7,所以我想它應該適用於armv6以及

+0

由於FFMPEG獲得LGPL/GPL許可,您知道您無法將FFMPEG用於要提交至App Store的應用程序嗎? – DarkDust

+0

@DarkDust是的,我知道。但我想要編譯它。我還有什麼建議可以用來實時檢索h.264幀? –

+0

[iFrameExtractor問題編譯ffmpeg問題]的可能重複(http://stackoverflow.com/questions/6994151/problem-compiling-ffmpeg-for-iframeextractor) –

回答

3

我使用以下編譯僅適用於armv6和armv7。我無法爲i386工作,我收到cputype和subcputype錯誤的錯誤。顯然cputype應該是x86,subcputype應該是intel。

反正我用下面的構建腳本編譯(我最終使用gcc和它的工作,這是配置的標誌是從一開始就錯了,我猜)爲ARM體系結構:

構建腳本:

#!/bin/sh 

set -e 

SCRIPT_DIR=$((cd -P $(dirname $0) && pwd)) 
DIST_DIR_BASE=${DIST_DIR_BASE:="$SCRIPT_DIR/dist"} 

if [ -d ffmpeg ] 
then 
    echo "Found ffmpeg source directory, no need to fetch from git..." 
else 
    echo "Fetching ffmpeg from git://git.videolan.org/ffmpeg.git..." 
    git clone git://git.videolan.org/ffmpeg.git 
fi 

ARCHS=${ARCHS:-"armv6 armv7"} 

for ARCH in $ARCHS 
do 
    FFMPEG_DIR=ffmpeg-$ARCH 
    if [ -d $FFMPEG_DIR ] 
    then 
     echo "Removing old directory $FFMPEG_DIR" 
     rm -rf $FFMPEG_DIR 
    fi 
    echo "Copying source for $ARCH to directory $FFMPEG_DIR" 
    cp -a ffmpeg $FFMPEG_DIR 

    cd $FFMPEG_DIR 

    DIST_DIR=$DIST_DIR_BASE-$ARCH 
    mkdir -p $DIST_DIR 

    case $ARCH in 
     armv6) 
      EXTRA_FLAGS="--enable-cross-compile --target-os=darwin --arch=arm --cpu=arm1176jzf-s" 
      EXTRA_CFLAGS="-arch $ARCH" 
      EXTRA_LDFLAGS="-arch $ARCH" 
      ;; 
     armv7) 
      EXTRA_FLAGS="--enable-cross-compile --target-os=darwin --arch=arm --cpu=cortex-a8 --enable-pic" 
      EXTRA_CFLAGS="-arch $ARCH" 
      EXTRA_LDFLAGS="-arch $ARCH" 
      ;; 
     x86_64) 
      EXTRA_CC_FLAGS="-mdynamic-no-pic" 
      ;; 
    esac 

    echo "Configuring ffmpeg for $ARCH..." 
    ./configure \ 
    --prefix=$DIST_DIR \ 
    --extra-ldflags=-L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/system \ 
    --disable-bzlib \ 
    --disable-doc \ 
    --disable-ffmpeg \ 
    --disable-ffplay \ 
    --disable-ffserver \ 
    --cc=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ 
    --sysroot=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk \ 
    --extra-ldflags="$EXTRA_LDFLAGS" \ 
    --extra-cflags="$EXTRA_CFLAGS" \ 
    $EXTRA_FLAGS 

    echo "Installing ffmpeg for $ARCH..." 
    make && make install 

    cd $SCRIPT_DIR 

    if [ -d $DIST_DIR/bin ] 
    then 
     rm -rf $DIST_DIR/bin 
    fi 
    if [ -d $DIST_DIR/share ] 
    then 
     rm -rf $DIST_DIR/share 
    fi 
done 

,並結合庫腳本:

#!/bin/bash 

set -e 

ARCHS="armv6 armv7" 

for ARCH in $ARCHS 
do 
    if [ -d dist-$ARCH ] 
    then 
    MAIN_ARCH=$ARCH 
    fi 
done 

if [ -z "$MAIN_ARCH" ] 
then 
    echo "Please compile an architecture" 
    exit 1 
fi 


OUTPUT_DIR="dist-uarch" 
rm -rf $OUTPUT_DIR 

mkdir -p $OUTPUT_DIR/lib $OUTPUT_DIR/include 

for LIB in dist-$MAIN_ARCH/lib/*.a 
do 
    LIB=`basename $LIB` 
    LIPO_CREATE="" 
    for ARCH in $ARCHS 
    do 
    if [ -d dist-$ARCH ] 
    then 
     LIPO_CREATE="$LIPO_CREATE-arch $ARCH dist-$ARCH/lib/$LIB " 
    fi 
    done 
    OUTPUT="$OUTPUT_DIR/lib/$LIB" 
    echo "Creating: $OUTPUT" 
    lipo -create $LIPO_CREATE -output $OUTPUT 
    lipo -info $OUTPUT 
done 

echo "Copying headers from dist-$MAIN_ARCH..." 
cp -R dist-$MAIN_ARCH/include/* $OUTPUT_DIR/include 

然後我從BUILD-FOLDER/DIST-uarch導入.a文件,它建立在Xcode就像一個魅力!

+0

對於cputype錯誤,請** make clean && make && make install **再次。 **使乾淨**的伎倆 – onmyway133