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

  • 相关阅读:
    MSBI
    Jsoncpp 使用方法大全
    Jsoncpp的使用
    istringstream、ostringstream、stringstream 类介绍 和 stringstream类 clear函数的真正用途
    使用 GDB 调试多进程程序
    操作系统标识宏
    gdb调试多线程程序总结
    boost 1.56.0 编译及使用
    c++ bind1st 和 bind2nd的用法
    纯真IP数据库(qqwry.dat)转换成最新的IP数据库格式(ipwry.dat)
  • 原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/2765409.html
Copyright © 2011-2022 走看看