Xcode5和ios7下交叉編譯ffmpeg

先申明本機環境html

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/c++


參考編譯選項
http://www.cnblogs.com/gugupluto/p/3404512.html 特此感謝
## 這裏是模擬器I386版本編譯
## 完美經過git

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 installgithub


## 編譯ffmpeg armv7(iPhone 3GS以上)
## 完美經過xcode

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)
## 完美經過app

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。其餘版本不須要。iphone

## to do
## 參數優化
## http://blog.csdn.net/whf727/article/details/18089261測試

相關文章
相關標籤/搜索