2011-08-10 30 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