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

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

问题描述

我正在尝试将应用程序移植到mac OSX.它使用openssl.我是xcode和mac开发的新手.我需要自己编译和安装openssl,还是OS的一部分或与Homebrew或类似软件一起提供的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.

有一些文档描述该过程 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天全站免登陆