编译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 

你可能感兴趣的:(ios,speex,编译静态库,语音编解)