为ios编译openssl
2012-11-11 20:43
309 查看
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 armv7
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/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdkmake
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 armv7
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/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdkmake
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
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 armv7
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/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdkmake
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 armv7
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/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdkmake
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
相关文章推荐
- 编译ios版openssl(2013/01/28)
- openssl在ios下的编译
- ios 编译openssl支持arm64
- ios 编译openssl支持arm64(转)
- 编译iOS libevent + openssl + tor
- 编译ios版本的librtmp+openssl
- ios 编译openssl支持arm64
- ios编译openssl曲折的过程纪录
- 编译ios版本的librtmp+openssl
- mac下ios 7.1 版本openssl编译
- ios 编译openssl支持arm64
- ios 编译openssl支持arm64
- iOS 编译openssl
- ios之编译openssl成静态库
- 为iOS(iPhone)开发环境编译OpenSSL库
- ios 编译openssl支持arm64
- mac编译iOS版openssl
- 编译 iOS 平台使用的openssl库
- 编译 Qt with Openssl for IOS
- iOS OpenSSL 编译