如何从源代码为iOS构建libssl.a? [英] How to build libssl.a for iOS from source code?

查看:273
本文介绍了如何从源代码为iOS构建libssl.a?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在xcode 5中有一个引用到libSSL.a的项目,所以我尝试自己构建它. make命令的错误消息是这样的:

我做了什么:

1,下载并安装命令行工具(从此处下载) >

2,从 openssl.net 下载源代码,,4509212 Jan 6 15:39:19 2014 openssl-1.0.1f.tar.gz (MD5) (SHA1) (PGP sign) [LATEST]

3,将文件crypto/ui/ui_openssl.cstatic volatile sig_atomic_t intr_signal;更改为static volatile int intr_signal;

4,使用以下命令制作Dirs:

mkdir ssllibs
cd openssl-1.0.0a
mkdir openssl_armv6 openssl_armv7 openssl_i386

5,配置: ./configure BSD-generic32 --openssldir=/Users/ccnyou/openssl-1.0.0a/openssl_i386 6,将MakefileCC= gcc编辑为CC= gcc -arch i386 7,在CFLAG之后添加 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk (这里可能是错误的) 8,make,只收到我上面提到的错误消息.

我想知道这是否是clang和ar的兼容性问题? 如何建立libssl.a? 任何为我提供建议的人都将不胜感激.

解决方案

我做了什么:1,下载并安装命令行工具(下载 从这里)2,从openssl.net下载源代码,4509212 1月6日 15:39:19 2014 openssl-1.0.1f.tar.gz(MD5)(SHA1)(PGP标志)[最新] 3,从静态volatile更改文件crypto/ui/ui_openssl.c sig_atomic_t intr_signal;静态volatile int intr_signal; 4,制作 带有命令的目录:...

OpenSSL具有针对iOS进行构建的说明.这些说明包括用于设置环境的构建脚本,以便设置正确的目标.您可以在 OpenSSL FIPS用户指南2.0 ,附录E中找到说明. .2.

如果您不想按照分步指南进行操作,请尝试此Github帐户.它为iOS 6.0和7.0(架构ARMv7,ARMv7s,i386和ARM64)预先构建了针对OpenSSL 1.0.1e和1.0.1f的OpenSSL. Github产品还提供了用于设置环境的脚本.

(很抱歉,链接答案.无法将所有信息摘要成几段).

I have a project referenced to libSSL.a in xcode 5,so I try to build it myself. error message of make command is this:

What I have done:

1, Download and install Command Line Tools (download from here)

2, Download source code from openssl.net ,4509212 Jan 6 15:39:19 2014 openssl-1.0.1f.tar.gz (MD5) (SHA1) (PGP sign) [LATEST]

3, Change file crypto/ui/ui_openssl.c from static volatile sig_atomic_t intr_signal; to static volatile int intr_signal;

4, Make Dirs with command:

mkdir ssllibs
cd openssl-1.0.0a
mkdir openssl_armv6 openssl_armv7 openssl_i386

5, Configure: ./configure BSD-generic32 --openssldir=/Users/ccnyou/openssl-1.0.0a/openssl_i386 6, Edit Makefile, CC= gcc to CC= gcc -arch i386 7, Add this after CFLAG -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk (may be wrong here) 8, make, just get error messages like I mentioned above.

I wonder if it is the clangs and ar's compatibilty problems ? How to build libssl.a ? I'll be appreciated to anyone who give me suggestions for it.

解决方案

What I have done: 1, Download and install Command Line Tools (download from here) 2, Download source code from openssl.net ,4509212 Jan 6 15:39:19 2014 openssl-1.0.1f.tar.gz (MD5) (SHA1) (PGP sign) [LATEST] 3, Change file crypto/ui/ui_openssl.c from static volatile sig_atomic_t intr_signal; to static volatile int intr_signal; 4, Make Dirs with command: ...

OpenSSL has instructions for building for iOS. The instructions include a build script to set the environemnt so the proper target is set. You can find the instructions in the OpenSSL FIPS User Guide 2.0, Appendix E.2.

If you don't want to go through the step-by-step guide, try out this Github account. Its got OpenSSL pre-built for iOS 6.0 and 7.0 (arch ARMv7, ARMv7s, i386, and ARM64) for OpenSSL 1.0.1e and 1.0.1f. The Github offering also offers the script to set the environment.

(Sorry about the link answers. There's no way to digest all the information into a couple of paragraphs).

这篇关于如何从源代码为iOS构建libssl.a?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆