編譯speex(i386、armv6、armv7、armv7s)方法

編譯speex(i386、armv6、armv7、armv7s)方法


本文借鑑:http://www.cocoachina.com/bbs/read.php?tid=114755&keyword=speex

桌面上建立speexLibrary文件夾,將下載的libogg-1.3.0speex-1.2rc1放入;

一、編譯ogg:

1.ogg-i386的庫

通過如下命令進入/Users/wangping/Desktop/speexLibrary/libogg-1.3.0目錄,因爲configure在此目錄下:

1)cd Desktop/

2)ls

3)cd speexLibrary/

4)ls

5)cd libogg-1.3.0/

直接用:cd Desktop/speexLibrary/libogg-1.3.0/

編譯ogg-i386庫:

6./configure -prefix=/Users/wangping/Desktop/speexLibrary/libogg-1.3.0/i386 -host=i386-apple-darwin -build=x86_64-apple-darwin11.3.0 CC="/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=c99 -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/"

7make  (如提示make命令無效,則xcode -> preferences ->downloads -> command line tools安裝)

make install

make clean (一定要clean,不然後面編譯的都是第一次的編譯的內容)


2ogg-armv6的庫 --不使用(無必要)

xcode4.6默認不能編譯armv6(可以編譯方法:http://blog.csdn.net/lmxxf/article/details/8770286)

./configure -prefix=/Users/wangping/Desktop/speexLibrary/libogg-1.3.0/armv6 -host=armv6-apple-darwin -build=x86_64-apple-darwin11.3.0 CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=c99 -arch armv6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/"


make

make install

make clean 


3ogg-armv7的庫

./configure -prefix=/Users/wangping/Desktop/speexLibrary/libogg-1.3.0/armv7 -host=armv7-apple-darwin -build=x86_64-apple-darwin11.3.0 CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=c99 -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/"


4、ogg-armv7s的庫


4./configure -prefix=/Users/wangping/Desktop/speexLibrary/libogg-1.3.0/armv7s -host=armv7s-apple-darwin -build=x86_64-apple-darwin11.3.0 CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=c99 -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/"


make

make install

make clean


二、接着編譯speex庫:

關掉終端,重新打開

首先進入文件夾:cd Desktop/speexLibrary/speex-1.2rc1/

1.speex-i386的庫

./configure -prefix=/Users/wangping/Desktop/speexLibrary/speex-1.2rc1/i386 -host=i386-apple-darwin -disable-shared -enable-static -disable-oggtest -disable-fixed-point -enable-float-api -build=x86_64-apple-darwin11.3.0 -with-ogg=/Users/wangping/Desktop/speexLibrary/libogg-1.3.0/i386 CC="/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=c99 -arch i386 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/"


make

make install

make clean 


2.speex-armv6的庫 --不使用(無必要)

./configure -prefix=/Users/wangping/Desktop/speexLibrary/speex-1.2rc1/armv6 -host=armv6-apple-darwin -disable-shared -enable-static -disable-oggtest -enable-fixed-point -disable-float-api -build=x86_64-apple-darwin11.3.0 -with-ogg=/Users/wangping/Desktop/speexLibrary/libogg-1.3.0/armv6 CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=c99 -arch armv6 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/"


make

make install

make clean


3.speex-armv7的庫

./configure -prefix=/Users/wangping/Desktop/speexLibrary/speex-1.2rc1/armv7 -host=armv7-apple-darwin -disable-shared -enable-static -disable-oggtest -enable-fixed-point -disable-float-api -build=x86_64-apple-darwin11.3.0 -with-ogg=/Users/wangping/Desktop/speexLibrary/libogg-1.3.0/armv7 CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=c99 -arch armv7 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/"


4speex-armv7s的庫

./configure -prefix=/Users/wangping/Desktop/speexLibrary/speex-1.2rc1/armv7s -host=armv7s-apple-darwin -disable-shared -enable-static -disable-oggtest -enable-fixed-point -disable-float-api -build=x86_64-apple-darwin11.3.0 -with-ogg=/Users/wangping/Desktop/speexLibrary/libogg-1.3.0/armv7s CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 -std=c99 -arch armv7s -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/"


make

make install

make clean 


最後合併靜態庫,進入相應文件夾:,終端鍵入:

1)合併libogg

libogg-1.3.0下建立OutPut_A文件夾:

cd Desktop/speexLibrary/libogg-1.3.0/

不帶arm6:

lipo -create i386/lib/libogg.a armv7/lib/libogg.a armv7s/lib/libogg.a -output libogg.a


2)合併speex的2個庫

speex-1.2rc1下建立OutPut_A文件夾:

cd Desktop/speexLibrary/speex-1.2rc1/

不帶arm6:

lipo -create i386/lib/libspeex.a armv7/lib/libspeex.a armv7s/lib/libspeex.a -output OutPut_A/libspeex.a

lipo -create i386/lib/libspeexdsp.a armv7/lib/libspeexdsp.a armv7s/lib/libspeexdsp.a -output OutPut_A/libspeexdsp.a 



好了,這裏應該已經編譯完成了。如果合併靜態庫不成功,那麼請檢查上述步驟(我當時就是忘了make clean,導致編譯的都是i386.a文件).你可以lipo -info xxx.a文件,後面會顯示庫內文件使用的平臺信息,正常顯示爲i386,armv6,armv7那麼就成功了。當然打包好的庫我也一併上傳了,方便大家下載。

cd Desktop/speexLibrary/libogg-1.3.0/OutPut_A


查看編譯好的.a的架構:

都拷貝到桌面上來,然後

cd Desktop

lipo -info libogg.a

lipo -info libspeex.a

lipo -info libspeexdsp.a

爲:i386 armv7 (cputype (12) cpusubtype (11)) 

另:在本身的文件夾裏看:

bogon:speex-1.2rc1 wangping$ cd OutPut_A

bogon:OutPut_A wangping$ lipo -info libspeex.a

Architectures in the fat file: libspeex.a are: i386 armv6 armv7 

bogon:OutPut_A wangping$ lipo -info libspeexdsp.a

Architectures in the fat file: libspeexdsp.a are: i386 armv6 armv7 

發佈了73 篇原創文章 · 獲贊 0 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章