./configure -prefix=/Users/share02/Desktop/libogg/i386 -host=i386-apple-darwin -build=x86_64-apple-darwin11.4.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/iPhoneSimulator5.1.sdk/"
(在执行的时候如果你的终端提示你不能执行,你可以在前面加一bash然后空格再跟这句命令,其实你可以关机然后重启就能执行了,我也不知道什么问题,有了解的可以留言大家一起学习与进步)
make
(如果你执行make命令是,终端提示没有make这个命令,那么你需要做以下的一步)
点击安装你的Downloads下面的Command Line Tools工具,然后就可以了执行make和make install命令了,如果还提示你可以退出然后重新打开你的终端再运行make命令。
make install
(在make install执行完成后,在/Users/share02/Desktop/libogg/这个路径下面会生成i386的文件夹,在i386下面生成了libogg.a这个文件,这就是i386环境用的ogg静态库)
(如果这个时候你的环境被你打乱,没有按照顺序成功执行,你可以在这里执行 make distclean,不然你到后面整合静态库的时候可能会报都是i386的同一个静态库没法整合的错)(我当时就遇到这个问题很蛋疼感觉什么都是对的就是为什么编译成同一个东西了)
2. compile ogg for armv6
./configure -prefix=/Users/share02/Desktop/libogg/armv6 -host=armv6-apple-darwin -build=x86_64-apple-darwin11.4.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/iPhoneOS5.1.sdk/"
make
make install
(make distclean)
3. compile ogg for armv7
./configure -prefix=/Users/share02/Desktop/libogg/armv7 -host=armv7-apple-darwin -build=x86_64-apple-darwin11.4.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/iPhoneOS5.1.sdk/"
make
make install
(make distclean)
编译speex
4. compile speex for i386(simulator)
./configure -prefix=/Users/share02/Desktop/speex-1.2rc1/i386 -host=i386-apple-darwin -disable-shared -enable-static -disable-oggtest -enable-fixed-point -disable-float-api -build=x86_64-apple-darwin11.4.0 -with-ogg=/Users/share02/Desktop/libogg/i386CC="/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/iPhoneSimulator5.1.sdk/"
make
make install
(make distclean)
5. compile speex for armv6
./configure -prefix=/Users/share02/Desktop/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.4.0 -with-ogg=/Users/share02/Desktop/libogg/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/iPhoneOS5.1.sdk/"
make
make install
(make distclean)
6. compile speex for armv7
./configure -prefix=/Users/share02/Desktop/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.4.0 -with-ogg=/Users/share02/Desktop/libogg/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/iPhoneOS5.1.sdk/"
make
make install
(make distclean)
把上门编译所生成的i386,armv6,armv7的libogg.a整合成一个整体的(意思是3个环境都可以用的)
speex同理
7. combine ogg for ios
lipo -create i386/lib/libogg.a armv6/lib/libogg.a armv7/lib/libogg.a -output libogg.a
8. combine speex for ios
lipo -create i386/lib/libspeex.a armv6/lib/libspeex.a armv7/lib/libspeex.a -output libspeex.a
9. combine speexdsp for iOS
lipo -create i386/lib/libspeexdsp.a armv6/lib/libspeexdsp.a armv7/lib/libspeexdsp.a -output libspeexdsp.a
(特别注意第9步,因为在网上没有任何地方说要编译第9步的,曾经我也没执行这步,后面用到编码函数时候很多报这样的错:Undefined symbols for architecture i386:
(注意上面2句执行的时候一定要cd到各自的目录下面去执行,同时提醒记得ogg编译完后编译speex记得换目录,别粗心大意。执行完上面2句整合过后我们就能够在ogg和speex目录下面找到我们所需要libogg.a和libspeex.a静态库)
把上门编译所生成的i386,armv6,armv7的libogg.a整合成一个整体的(意思是3个环境都可以用的)
speex同理,首先我们要注意的是,一次性顺序编译
接下来就是以ogg编译i386为例子对于编译语句的具体分析和说明,虽然不大了解具体意思说的不对请指教,
首先我们应该把下载下来的ogg和speex放在一个路径相对方便的地方,我是放在桌面即Desktop,我们要执行就要cd到ogg或者speex的目录下,这样才能执行configure命令 ,
-prefix后面/Users/share02/Desktop/libogg/i386是编译成功后生成i386文件以及静态库的路径,最好放在你下载的ogg文件下,方便后面整合的时候路径简单。
-host后面是所跟的参数i386-apple-darwin -build=x86_64-apple-darwin11.4.0不需要更改。
CC后面跟的是你xcode,的i386的gcc编译器路径,这个需要根据你自己的xcode的路径来决定,具体咋个看呢,右击你的xcode,在finder中显示,然后
然后就可以根据/Contents/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
(爱图腾博客路径是./configure -prefix=/Users/Rainbow/ogg/i386 –host=i386-apple-darwin –build=x86_64-apple-darwin10.8.0 CC=”/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -std=c99 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/”)。
-isysroot后面跟的是你的iPhoneSimulator或者iPhoneOS的sdk路径,和上面同理写你自己的路径,这个路径和上面差不多。
(最后注意的是字符问题,全是英文,每个参考之间有个空格-prefix,-build,
在编译armv6,
http://blog.csdn.net/ysysbaobei/article/details/8838900
http://www.xiph.org/downloads/
http://blog.sina.com.cn/s/blog_674f4fc6010112a4.html
http://www.cocoachina.com/ask/questions/show/94892/%E6%80%8E%E6%A0%B7%E8%83%BD%E8%AE%A9speex%E6%94%AF%E6%8C%81iphone5%EF%BC%88armv7s%EF%BC%89