首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >armv6 6-7的失败构建ffmpeg

armv6 6-7的失败构建ffmpeg
EN

Stack Overflow用户
提问于 2011-08-10 07:32:14
回答 1查看 4.4K关注 0票数 2

我一直在努力用我能想到的每一种可能的方法来建立框架。我正在尝试从他们的git存储库中获得最新的修订版,并使用一个构建脚本(我已经确认了它的工作能力),它来自于这个问题:iPhone SDK4.3libav编译问题。剧本昨天更新了,显然对问题中的那个人有用。

我的问题是,它不会为.a anc armv7生成armv6文件(或实际上任何文件)。因此,要将lipo命令连接到通用库中,就会失败。我也尝试过使用来自iFrameExtractor的构建脚本,但没有成功--它也失败了--最后,我得到了以下命令:

代码语言:javascript
复制
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)

我还发布了整个输出这里,如果有人知道在那里查找什么(因为我不知道从哪里开始,它几乎有5000行输出)。我还应该提到,我正在为armv6armv7i386编译它。我想在XCode中导入它,以便从视频提要中获取H.264帧。

当我尝试为armv6构建时,我使用以下配置:

代码语言:javascript
复制
./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

并获得以下输出:

代码语言:javascript
复制
/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
ffmpeg-user@ffmpeg.org 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编译器呢?我尝试过不同的方法:手臂-苹果-杜温10- gcc -4.2.1手臂-苹果-达温10-11岁-gcc-4.2岁

但结果是一样的。gcc为i386和armv7工作,所以我想它也适用于armv6。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-08-12 08:54:07

我使用以下方法只为armv6和armv7编译。我无法让它为i386工作,我收到的错误是cputype和subcputype是错误的。显然,cputype应该是x86,subcputype应该是intel。

无论如何,我使用以下构建脚本来编译arm体系结构(我最后使用了gcc,它工作了,从一开始就错误的是配置标志):

构建脚本:

代码语言:javascript
复制
#!/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

并结合libs脚本:

代码语言:javascript
复制
#!/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-文件夹/Dist-uarch中导入.a文件,它以xcode构建,就像一个魅力!

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7007305

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档