Xcode5和ios7下交叉编译ffmpeg

先申明本机环境

dev-mini:ffmpeg devone$ sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.9.2
BuildVersion:   13C1021 dev-mini:ffmpeg devone$ xcodebuild -version
Xcode 5.1.1
Build version 5B1008 ## IOS7.1

http://ffmpeg.org/releases/ffmpeg-2.2.2.tar.bz2
sudo wget http://ffmpeg.org/releases/ffmpeg-2.2.2.tar.bz2
sudo wget https://github.com/yuvi/gas-preprocessor/blob/master/gas-preprocessor.pl
sudo cp gas-preprocessor.pl /usr/bin/
sudo chmod a+rwx /usr/bin/gas-preprocessor.pl

Xcode path
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/

参考编译选项
http://www.cnblogs.com/gugupluto/p/3404512.html 特此感谢
## 这里是模拟器I386版本编译
## 完美通过

sudo ./configure --prefix=../i386 --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-mmx --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk" --target-os=darwin --cc="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" --extra-cflags="-arch i386 -mfpu=neon -miphoneos-version-min=7.0" --extra-ldflags="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -miphoneos-version-min=7.0" --arch=i386 --cpu=i386 --disable-asm --disable-everything --enable-decoder=h264 --enable-decoder=rv40 --enable-decoder=aac 

sudo make
sudo make install

## 编译ffmpeg armv7(iPhone 3GS以上)
## 完美通过

sudo ./configure --prefix=../armv7 --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk" --target-os=darwin --cc="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" --extra-cflags="-arch armv7" --extra-ldflags="-arch armv7" --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/usr/lib/system --arch=arm --cpu=cortex-a8 --enable-pic  --disable-asm --disable-everything --enable-decoder=h264 --enable-decoder=rv40 --enable-decoder=aac 

## 编译ffmpeg armv7s(iPhone5)
## 完美通过

sudo ./configure --prefix=../armv7s --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --enable-cross-compile --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk" --target-os=darwin --cc="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc" --extra-cflags="-arch armv7s -mfpu=neon -miphoneos-version-min=7.0" --extra-ldflags="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -miphoneos-version-min=7.0" --arch=arm --cpu=cortex-a9 --enable-pic  --disable-asm --disable-everything --enable-decoder=h264 --enable-decoder=rv40 --enable-decoder=aac 

## 说明
1. 以前需要gas-preprocessor.pl这个文件,但经过测试,在XCode4环境下是需要的,XCode5环境下已经不需要了。
2. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc 这里cc c++ clang++ 都是clang的软连接
3. 多了一个-miphoneos-version-min=7.0,没有这个字段会出错:
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc is unable to create an executable file.
  C compiler test failed.
 仅仅是针对I386模拟器版本编译参数 --extra-ldflags 后面的那个-miphoneos-version-min=7.0。其他版本不需要。

## to do
## 参数优化
## http://blog.csdn.net/whf727/article/details/18089261

上一篇:Python Base64 编码


下一篇:mobile优化