MACOSX_DEPLOYMENT_TARGET和-mmacosx-version-min有什么区别? [英] What is the difference between MACOSX_DEPLOYMENT_TARGET and -mmacosx-version-min?

查看:1410
本文介绍了MACOSX_DEPLOYMENT_TARGET和-mmacosx-version-min有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常需要将Mac OS X版本定位为比我当前正在运行的版本更早的版本.由于我更喜欢​​使用bash shell和Makefile,因此我不使用Xcode.苹果明确支持以旧版OS X为目标,但我一直对通常用于较旧平台的两个配置步骤的冗余性感到困惑:

I often need to target Mac OS X versions that are older than the one I'm currently running. As I prefer to work with a bash shell and Makefiles, I do not use Xcode. Apple explicitly supports targeting older OS X versions, but I've always been confused by the redundancy of the two configuration steps that are usually taken to target older platforms:

  1. gcc使用--macosx-version-min启动:

gcc --mmacosx-version-min=10.6 ....

  • MACOSX_DEPLOYMENT_TARGET环境变量设置为所需的平台,例如

  • The MACOSX_DEPLOYMENT_TARGET environment variable is set to the desired platform, e.g.

    export MACOSX_DEPLOYMENT_TARGET=10.6
    

  • 当尝试通过搜索找出两者之间的实际差异时,您会得出不同的答案. 有些人说他们做的完全一样,因此只需要使用两者之一即可.但是,也有声音表示必须同时执行以下操作:以--macosx-version-min 开头的gcc并设置环境变量.

    When trying to figure out the actual difference between the two by searching, you'll come up with different answers. Some people say that they do exactly the same, so it's only necessary to use one of the two. However, there are also voices which say that it's necessary to do both: start gcc with --macosx-version-min and set the environment variable.

    这两件事完全一样吗?是否仅需要使用两者之一而不是两者?某处有一些官方文档吗? 苹果提到了MACOSX_DEPLOYMENT_TARGET ,但没有即使它似乎更常见,也根本不提--macosx-version-min.

    Are these two things exactly the same? Is it only necessary to use one of the two but not both? Is there some official documentation available somewhere? Apple mentions MACOSX_DEPLOYMENT_TARGET but doesn't mention --macosx-version-min at all, even though it seems to be much more common.

    推荐答案

    在Mac OS X上gcc的手册页说它们是同义词:

    The man pages of gcc on Mac OS X say that they're synonymous:

    -mmacosx-version-min=version
    The earliest version of MacOS X that this executable will run on is
    version.  Typical values of version include 10.1, 10.2, and 10.3.9.
    
    This value can also be set with the MACOSX_DEPLOYMENT_TARGET environment
    variable.  If both the command-line option is specified and the
    environment variable is set, the command-line option will take precedence.
    

    这篇关于MACOSX_DEPLOYMENT_TARGET和-mmacosx-version-min有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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