macosx-version-min 是什么意思? [英] what does macosx-version-min imply?

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

问题描述

当我传递编译器标志 -mmacosx-version-min=10.5 时,它是什么意思?我认为这意味着结果二进制是 x86,而不是 ppc,但它是 32 位还是 64 位?我在雪豹上编译,所以默认输出二进制是 64 位.我没有通过 -universal,我认为它不是 32 位-64 位通用二进制文件.

When I pass compiler flag -mmacosx-version-min=10.5, what does it mean? I think it implies the result binary is x86, not ppc, but is it 32 bits or 64 bits? I'm compiling on snow leopard, so default output binary is 64 bits. I'm not passing -universal, it's not 32bit-64bit universal binary, I think.

推荐答案

此选项将由放置在标题中的各种可用性宏使用.这意味着您可能需要最低版本的操作系统,即使您有更新的 SDK(即使用 10.6 SDK 定位 10.5).在面向 10.5 的同时使用 10.6 API 将触发警告,并且该 API 将与weak_import 属性相关联.

This option will be used by the various availability macros placed into the headers. This means that you can require a minimum version of OS, even if you have a more recent SDK (i.e. target 10.5 with a 10.6 SDK). Using a 10.6 API while targetting 10.5 will trigger a warning and the API will be linked with a weak_import attribute.

大多数 Apple 的 API 标头都包含每个类、方法、函数或枚举的可用性宏,以便为每个类进行声明:

Most Apple's API headers contains availability macros for each class, methods, functions or enumerations in order to declare for each of them:

  • 支持的最低操作系统
  • 弃用
  • 不可用
  • ...

宏看起来像:

  • AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
  • AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED
  • ...

至于架构,它仅取决于 SDK 二进制文件中的可用架构.例如,对于 10.5 SDK,您可以针对四种架构(Intel/32bits、PowerPC/32bits、Intel/64bits、PowerPC 64bits),而对于 10.6 SDK,您只能针对三种架构(Intel/32bits、PowerPC/32bits、英特尔/64 位).

As for the architecture, it only depends on the available architectures in the binaries of the SDK. For example with a 10.5 SDK, you can target four architectures (Intel/32bits, PowerPC/32bits, Intel/64bits, PowerPC 64bits), while with a 10.6 SDK, you can only target three architecture (Intel/32bits, PowerPC/32bits, Intel/64bits).

当您使用 Snow Leopard 时,您可以非常简单地通过传递这样的架构选项来定位 i386(英特尔/32 位)、ppc(PowerPC/32 位)或 x86_64(英特尔/64 位):

As you are using Snow Leopard, you can either target i386 (Intel/32bits), ppc (PowerPC/32bits) or x86_64 (Intel/64bits) very simply by passing an architecture option like this:

gcc -arch i386

或者像这样(对于基于配置的项目):

or like this (for configure-based projects):

CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure

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

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