2012-09-13 48 views
4

我想编译iOS5的ffmpeg库。我尝试了不同的选择,但都没有工作为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 is unable to create an executable file. C compiler test failed.

我找遍了整个互联网。我已阅读关于此stackoverflow的所有帖子,但没有帮助我。请告诉我我做错了什么,请不要张贴我的链接:相信我,我看到了他们!

回答

2

检查config.log文件根目录编制和搜索“C编译器测试failed.`”你会发现那里已尝试的命令和确切原因为什么会失败(即,编译器的输出)。

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

其实,我看到的是你在configure命令行上指定了几条路径,你是否检查过它们对你的Xcode版本是否正确?

3

这适用于iOS 5.0和Snow Leopard。 您必须更改ldflags,sysroot和cc以提供有效的路径,以便Mountain Lion 中的Xcode被移至antoher文件夹。

./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 
+0

我试过这个,我不再收到那个错误。但是在我输入“make”命令后,我收到了这个错误:错误:.endm没有.macro在/usr/local/bin/gas-preprocessor.pl 83行, 53行。 –

+1

苹果有一个过时的气体预处理器特等。我已经用这个替换它https://github.com/yuvi/gas-preprocessor –

+0

在我的情况下,当我输入make命令我得到:command not found,我该怎么办? – Swati

1

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

如果版本对您来说并不是那么重要,我们有一个预构建的框架ffmpeg 8,真的是 我们没有发现使用这两个并发现ffmpeg 8具有较少的性能问题。

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

如果你有狮子或雪豹构建中,您或许可以修改我们的构建脚本,并建立FFMPEG 11,别人都做到了这一点。