如何将 OpenSSL 添加到 Xcode 项目 [英] How to add OpenSSL to an Xcode project

查看:33
本文介绍了如何将 OpenSSL 添加到 Xcode 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将应用程序移植到 mac OSX.它使用openssl.我是 xcode 和 mac 开发的新手.我是否需要自己编译和安装 openssl,或者是否有一些等效的 openssl-devel 软件包作为操作系统的一部分或自制软件或类似软件提供?

I am trying to port an application to mac OSX. It uses openssl. I am new to xcode and mac development. Do I need to compile and install openssl myself, or is there some equivalent of an openssl-devel package available as part of the OS or with homebrew or some such?

推荐答案

您需要自己编译和链接它,并且您的应用需要发布它.如果您的应用程序的许可证和 OpenSSL 的许可证兼容,您可以使用静态链接.否则,您将需要动态链接它.

You will need to compile and link it yourself, and your app needs to ship it. If the license of your app and OpenSSL's license are compatible, you may use static linking. Otherwise you will need to dynamically link it.

有几个文档描述该过程构建脚本,您可以通过 Google 搜索找到.对于 iOS,甚至还有一个 Github 项目.那些文件的内容我没有在这里复制,因为它太多了,而且是一个移动的目标.

There are a few documents describing the process and build scripts that you can find with Google searches. For iOS, there's even a Github project. I didn't copy the contents of those documents here since it's too much and it's a moving target.

您还可以使用 Homebrew 安装 OpenSSL.如果您只想让您的应用程序在您的 Mac 上运行而您不想分发它,这是最简单的方法:您只需要链接它.但是如果你想分发你的应用程序,你需要将库/库复制到你的应用程序包并确保链接器在那里找到它.这也有一个缺点,即您的应用程序和 OpenSSL 版本之间可能存在断开连接":如果在一年内,您使用 Homebrew 更新 OpenSSL 并希望针对与您完全相同的 OpenSSL 版本编译/链接旧版本的应用程序那个时候用过,有问题.

You can also install OpenSSL with Homebrew. If you just want to have your app run on your Mac and you don't want to distribute it, this is the easiest way: you just need to link it. But if you want to distribute your app, you would need to copy the library/libraries to your app bundle and make sure the the linker finds it there. This also has the disadvantage that there's a possible "disconnect" between your app and the OpenSSL version: if in one year, you update OpenSSL with Homebrew and want to compile/link an older version of your app against the very same OpenSSL version as you've used at that time, you have a problem.

这篇关于如何将 OpenSSL 添加到 Xcode 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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