fix: Flip signs in Time.h's Apple version checks#1688
fix: Flip signs in Time.h's Apple version checks#1688amgleitman wants to merge 1 commit intofacebook:mainfrom
Conversation
|
Hi @amgleitman! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@kelset I remember there was a lot of issues around the |
|
New year, new ping! Anything we can do to move this PR forward? I'm somewhat optimistic it'll help remove some of the "hacks" were needed for RN 0.66 =) |
|
@Orvid has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
When trying to bring react-native-macos up to date with 0.66, I was running into an issue getting RNTester to compile due to an error regarding redefining
clockid_t. Other people have been seeing similar issues as per these search results.The history behind this appears to be as follows:
Several declarations in
<time.h>were not available on Apple platforms until macOS 10.12 and iOS 10, which is why Folly needs to check the minimum version and setFOLLY_HAVE_CLOCK_GETTIMEas needed. The problem is, the current logic as it stands right now is to setFOLLY_HAVE_CLOCK_GETTIME = 1(which implies that we don't need to declare them ourselves as the OS provides them for us) if...However, this doesn't make any sense. This is saying that we don't need to declare these missing APIs if we could be compiling Folly for use on an older version (i.e., macOS 10.11/iOS 9 or earlier), which is totally wrong! Instead, we ought to be checking if the versions are at least macOS 10.12 or iOS 10.
React Native currently works around this by eliminating the minimum version check entirely with this PR, which is certainly a valid local fix (the minimum iOS version for React Native apps is currently iOS 11), but doesn't solve the problem at its core. This PR does solve the problem.
I have not tested building this with a minimum version below the above thresholds for use on a modern version of macOS/iOS, but considering the discussion in #1545, I think we should be safe to ignore these older versions from now on.