zoukankan      html  css  js  c++  java
  • 为ios编译openssl

    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.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 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.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

  • 相关阅读:
    Android开发学习之路-使用Handler和Message更新UI
    Android开发学习之路-Service和Activity的通信
    Android开发学习之路-自定义ListView(继承BaseAdapter)
    URI、URL、URN
    理解 node.js 的事件循环
    创建hexo风格的markdown页面
    heroku
    js通过沿着作用域链还是原型链查找变量
    浏览器中实现3D全景浏览
    数据可视化图表ECharts
  • 原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/2765409.html
Copyright © 2011-2022 走看看