What is meant by macosx-version-min?

When I pass the compiler flag -mmacosx-version-min=10.5 , what does this mean? I think this means the binary result is x86, not ppc, but is it 32 bits or 64 bits? I compile on a snow leopard, so the default binary output is 64 bits. I do not go through -universal , it is not a 32-bit 64-bit universal binary, I think.

+24
g ++ 32bit-64bit macos
May 27 '10 at 17:47
source share
4 answers

This parameter will be used by various accessibility macros located in the headers. This means that you can require a minimal OS version, even if you have a more recent SDK (i.e. Target 10.5 with 10.6 SDK). Using API 10.6 when configuring 10.5 will result in a warning and the API will be associated with the value of the weak_import attribute.

Most Apple API headers contain accessibility macros for each class, method, function, or enumeration to declare for each of them:

  • Minimum OS Supported
  • Renouncement
  • Unavailability
  • ...

Macros look like this:

  • AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER
  • AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED
  • ...

In terms of architecture, it depends only on the available architectures in the SDK binaries. For example, with 10.5 SDKs you can target four architectures (Intel / 32bits, PowerPC / 32bits, Intel / 64bits, PowerPC 64bits), and with 10.6 SDKs you can only use three architectures (Intel / 32bits, PowerPC / 32bits, Intel / 64bit).

As you use Snow Leopard, you can either target i386 (Intel / 32bits), ppc (PowerPC / 32bits), or x86_64 (Intel / 64bits) very simply by passing this architecture variant:

 gcc -arch i386 

or like this (for configuration based projects):

 CFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure 
+19
May 28 '10 at 7:08 a.m.
source share

-mmacosx-version-min=... also affects the default choice of C ++ STL implementation (GNU or LLVM), and in this respect it is equally important for the compiler and linker.

+12
Nov 06 '13 at 18:13
source share

From my testing, it is also important that this parameter is passed to the link stage (for example, -arch); therefore, it affects macros / preprocessing more (how can this be done from other answers).

When it is passed to the compilation stage, but not passed to the link stage, I found that shared libraries built with 10.6 will not load under 10.5.

+10
Oct 10 '10 at 5:41
source share

It launches compiler warnings for methods introduced after Mac OS X 10.5. This has nothing to do with architecture.

+4
May 27 '10 at 17:51
source share



All Articles