ios版本:5.1
os:lion 10.7.4
1)编译arm6
makedir arm6lib
./configure BSD-generic32 --prefix=/libs/openssl --openssldir=/libs/openssl
更改文件MakeFile
CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
make
make install
将arm6lib 目录复制出来
删除openssl-0.9.8d目录因为发现make clean并不是真的全部清除,留有很多.o文件 直接在这个在环境中编译arm7的会产生错误
2) 编译arm7
在新的环境中编译和arm6的类似6
makedir arm7lib
./configure BSD-generic32 --prefix=/libs/openssl --openssldir=/libs/openssl
更改文件MakeFile
CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
make
make install
将arm7lib 目录复制出来
3)连接为universal lib
前面我们将arm6lib arm7lib复制到一个目录,进入这个目录
lipo -create ./arm6lib/lib/libcrypto.a ./arm7lib/lib/libcrypto.a -output ./libcrypto.a
lipo -create ./arm6lib/lib/libssl.a ./arm7lib/lib/libssl.a -output ./libssl.a
检验结果
lipo -info libssl.a
结果为:
Architectures in the fat file: libssl.a are: armv6 armv7
表示成功
4)模拟器编译
与上面类似,只是修改Makefile时有点不同
CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386
CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk