several messages
Joshua Root
jmr at macports.org
Sun Jul 5 07:44:49 UTC 2020
On 2020-7-5 14:08 , Fred Wright wrote:
>
> Since having those defined differently would only be expected in cases
> where the build target is a range of OS versions, and since MacPorts has
> no concept of "OS version universality" and hence always targets one
> specific OS version, once would expect the two definitions to be the
> same in the MacPorts environment. But aside from it being cleaner to
> use the correct macro for the context, there's at least one case where
> they're *not* the same. From the default compiler on 10.5.8:
>
> MacMini:OSX fw$ ./conftest
> __APPLE__ = 1
> __MAC_OS_X_VERSION_MIN_REQUIRED = 1058
> __MAC_OS_X_VERSION_MAX_ALLOWED = 1060
> _POSIX_VERSION = 200112
>
> Thus, using MAX_ALLOWED to distinguish 10.5 from 10.6 doesn't work.
> There are several ports that don't build on 10.5 for precisely this reason.
The reason for this, by the way, is that this toolchain is aware that
10.6 exists and it is always assumed by default that you want access to
the latest features. Any symbols that are present in the max_allowed OS
but not in the min_required are weak-linked, and programs are expected
to check that those symbols are non-null before using them. That is the
Apple way of being compatible with multiple OS versions in a single
binary, but naturally it almost never happens in the open source world.
- Josh
More information about the macports-dev
mailing list