Page MenuHomePhabricator

Fix build on macOS sdk 10.12 and newer
ClosedPublic

Authored by nihui on Mar 24 2020, 9:42 PM.

Details

Summary

syscall() has been deprecated and is not available on macOS 10.12.

Diff Detail

Event Timeline

nihui created this revision.Mar 24 2020, 9:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 24 2020, 9:42 PM
fhahn added a reviewer: yln.Mar 25 2020, 4:10 AM
fhahn added a subscriber: fhahn.

Looks fine in general. Julian, any chance you could take a quick look at this? Or suggest someone who would be more appropriate? Thanks :)

AndreyChurbanov added inline comments.
openmp/runtime/src/kmp_wrapper_getpid.h
26

I am not an expert on MacOS, but this #if looks wrong. Because on earlier systems macro __MAC_10_12 is not defined, thus making the comparison to always be TRUE, and the code on #else is then a dead code.

Probably the comparison with the value of the macro (like 101200) could work instead.

yln added a comment.EditedApr 2 2020, 3:54 PM

Looks fine in general. Julian, any chance you could take a quick look at this?

For the sanitizers we are going the route of requiring a SDK that isn't super old. Asking people/CI builders to upgrade to SDK 10.12 for building seems reasonable at this point (https://reviews.llvm.org/D74501).
Of course this doesn't solve the underlying issue of running on old systems (governed by the deployment target), but at least you can take advantage of the availability annotations in the SDK to do a proper runtime check.

In this particular case pthread_mach_thread_np seems to be a good general replacement (header says it's available since 10.4). I recommend just using it unconditionally.

nihui updated this revision to Diff 255131.Apr 5 2020, 3:09 AM

use pthread_mach_thread_np() unconditionally

This revision is now accepted and ready to land.Apr 15 2020, 10:48 AM
nihui added a comment.Aug 26 2020, 6:35 AM

I do not have commit access, someone has to commit the change for me (with attribution). Thanks

This revision was landed with ongoing or failed builds.Aug 26 2020, 6:53 AM
This revision was automatically updated to reflect the committed changes.