【问题标题】:Big problems while compiling FFMPEG for iOS5为 iOS5 编译 FFMPEG 时的大问题
【发布时间】:2012-09-06 09:51:08
【问题描述】:

我正在尝试为 iOS5 编译 ffmpeg 库。我尝试了不同的选项,但没有一个有效。

我下载了这个:https://github.com/ciphor/ffmpeg4ios

我尝试了原始的 build_armv7,但它不起作用。我编辑了 build_arm7 文件,现在它看起来像这样:

#!/bin/tcsh -f

if (! -d armv7) mkdir armv7
if (! -d lib) mkdir lib

rm armv7/*.a

make clean

./configure --disable-network --disable-mpegaudio-hp --disable-lpc --disable-vaapi 
--disable-vdpau --disable-hwaccels --disable-mmx --disable-mmx2 --disable-sse 
--disable-ssse3 --disable-avx --disable-amd3dnow --disable-amd3dnowext --disable-vis 
--disable-mmi --disable-doc --disable-yasm --disable-ffmpeg --disable-ffplay 
--disable-ffprobe --disable-ffserver --disable-rdft --disable-dxva2 --disable-encoders 
--disable-decoders --enable-decoder=h264 --disable-bsfs --disable-protocols 
--disable-indevs --disable-outdevs --disable-devices --disable-filters --disable-demuxers --enable-demuxer=h264 
--disable-muxers --disable-parsers --enable-parser=h264 --enable-cross-compile --arch=arm 
--target-os=darwin 
--cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 --as='gas-preprocessor/gas-preprocessor.pl /Aplications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2' 
--sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk --cpu=cortex-a8 
--extra-cflags='-pipe -Os -gdwarf-2 -issysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk -m${thumb_opt:-no-thumb} 
-mthumb-interwork' --extra-ldflags='-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk' --enable-pic


make

mv libavcodec/libavcodec.a armv7/
mv libavdevice/libavdevice.a armv7/
mv libavformat/libavformat.a armv7/
mv libavutil/libavutil.a armv7/
mv libswscale/libswscale.a armv7/

rm lib/*.a

cp armv7/*.a lib/

但我得到这个错误:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 无法创建可执行文件。 C 编译器测试失败。

我浏览了整个互联网。我已经阅读了关于 stackoverflow 的所有帖子,但没有一个对我有帮助。请告诉我我做错了什么,请不要给我发链接:相信我,我都看到了!

【问题讨论】:

    标签: objective-c xcode compiler-construction ffmpeg ios5.1


    【解决方案1】:

    检查根编译目录中的config.log 文件并搜索“C 编译器测试失败。”您将在那里找到尝试过的命令及其失败的确切原因(即编译器输出)。

    可能是编译器安装目录不是/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/,也可能是找不到某个库等...

    实际上,我看到的是您在configure 命令行上指定了一些路径。您是否检查过它们对于您的 Xcode 版本是否正确?

    【讨论】:

      【解决方案2】:

      这对我来说适用于 iOS 5.0 和 Snow Leopard。 您必须更改 ldflags、sysroot 和 cc 才能为 Mountain Lion 中的文件提供有效路径 对于 Xcode 已移至另一个文件夹。

      ./configure \
      --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system \
          --disable-muxers \
          --disable-demuxers \
          --disable-devices \
          --disable-parsers \
          --disable-protocols \
          --disable-filters \
          --disable-bsfs \
          --disable-doc \
          --disable-ffmpeg \
          --disable-ffplay \
          --disable-avfilter \
          --disable-avformat \
          --disable-ffserver \
          --disable-decoders \
          --disable-encoders \
          --disable-network \
          --enable-decoder=h261 \
          --enable-decoder=h263 \
          --enable-decoder=h263p \
          --enable-encoder=h261 \
          --enable-encoder=h263 \
          --enable-encoder=h263p \
          --enable-cross-compile \
          --enable-hardcoded-tables \
          --enable-memalign-hack \
          --enable-neon \
          --arch=arm \
          --target-os=darwin \
          --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
          --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk \
          --cpu=cortex-a8 \
          --extra-cflags='-arch armv7 -mno-thumb -mfpu=neon -mfloat-abi=softfp' \
          --extra-ldflags='-arch armv7 -mno-thumb -mfpu=neon -mfloat-abi=softfp' 2>&1 | tee configure.log
      
          make clean 
          make
      

      【讨论】:

      • 我试过这个,我不再收到那个错误了。但是在我输入“make”命令后,我收到了这个错误:错误:.endm without .macro at /usr/local/bin/gas-preprocessor.pl line 83, line 53.
      • apple 有一个过时的 gas-preprocessor.pl。我已将其替换为 github.com/yuvi/gas-preprocessor
      • 在我的情况下,当我输入 make 命令时,我得到:找不到命令,我该怎么办??
      • 我为 xcode 下载了命令行工具,但是当我运行 make 命令时,我得到:make:[libavcodec/arm/dsputil_arm.o] 错误 1
      【解决方案3】:

      如果你需要 ffmpeg 11 您可能需要使用雪豹或狮子,山狮似乎缺少关键的 gcc 编译器组件。我们正在研究为此修复我们的构建脚本

      如果版本对你来说不是那么重要,我们有一个用于 ffmpeg 8 的预构建框架,真的 我们没有发现使用两者之间有什么大的区别,并且发现 ffmpeg 8 的性能问题较少。

      https://github.com/mooncatventures-group/ffmpegDecoder

      如果您有一个带有狮子或雪豹的构建框,您可能可以修改我们的构建脚本并构建 ffmpeg 11,其他人已经这样做了。

      【讨论】:

        猜你喜欢
        • 2011-10-23
        • 1970-01-01
        • 1970-01-01
        • 2012-01-09
        • 2014-11-23
        • 2012-03-08
        • 2013-08-13
        • 2019-07-05
        相关资源
        最近更新 更多