Properly link against functions introduced in macOS 10.12 #350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
macOS Sierra/10.12 introduced new functions that are problematic to link against (i.e.
getentropy
,clock_gettime
, etc) becauseautoconf
detecting their presence isn't sufficient to guarantee they will be available downlevel. Building Python using Xcode 8 and the macOS 10.12 SDK and following Apple's recommended practices (see https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html), to setMACOSX_DEPLOYMENT_TARGET
to the minimum version to be supported (e.g.10.8
) will result in these functions being weakly linked. While testing on macOS 10.12 works properly, running Python on an older (yet declared supported) version will trigger a crash when the symbol is used, as the code doesn't appear to support the symbol being weakly defined (who would). Essentially,AC_CHECK_FUNCS
is not sufficient for these functions on macOS, so we need to do extra work.This patch alters
configure
not to check when building for Darwin andMACOSX_DEPLOYMENT_TARGET
is defined to a version below 10.12, allowing proper down-level support.