facebook / flipper

A desktop debugging platform for mobile developers.
https://fbflipper.com/
MIT License
13.33k stars 953 forks source link

🐛 MacCatalyst Does not Build on RN above 64 because of RCT-Folly (1/2 Fix Included Here!) #3117

Closed ZComwiz closed 2 years ago

ZComwiz commented 2 years ago

🐛 Bug Report

FLIPPER FOLLY MAC CATALYST SUPPORT BROKE AFTER SWITCHING TO XCFRAMEWORK. HERE IS WHAT HAPPENED: There are two bugs when building RN 65+ targeted to MacCatalyst located in Flipper:

1. Time.h redefinition. There is a hack in here in Time.h in RCT which I was able to consistently fix by adding a TARGET_OS_MACCATALYST flag on line 31. See my comment on the quick, robust, fix here.

2. DoubleConversion Not Found when building: When Flipper/Folly switched to xcFrameworks from the precompiled .a file, it seems they did not include a slice for MacCatalyst. I will include some helpful references here which the team at Flipper who is more familiar with the archiving process of the xcframework can use to quickly rectify this support regression:

a) Mike Hardy's awesome script which may help compile the DoubleConversion Library properly

b) A simple guide to building MacCatalyst slices when using an xcFrameworks

To Reproduce

Try building any react-native on any version 65 or greater with Mac as the target destination (MacCatalyst). You can do that by selecting iPad, then Mac in the General settings of the template HelloWorld Xcode Project. Switch Build Target to Mac at the top.

Recommend using the template in this branch of a release candidate of 67 which adds some robust fixes that will be integrated soon (but you can try on the latest RN 66 build).

Environment

Intel and M1 Macs alike: targeting MacCatalsyt. XCode Version 13.0 (13A233). Any version of React Native above 64, but you can use 66 or the release candidate mention above.

mikehardy commented 2 years ago

Confirmed fixed! Oh my $deity!! Finally able to close this one I think. I'm PR'ing version bumps to react-native now. Fantastic!

Arkkeeper commented 2 years ago

I've also tested the new versions by setting use_flipper!({'Flipper-DoubleConversion' => '3.2.0.1', 'Flipper-Glog' => '0.5.0.5'}) in Podfile, everything is ok, thanks!

There's one more bug with Flipper-Folly that prevents RN 0.68.x from being completely compatible with MacCatalyst, but it's another story.

kelset commented 2 years ago

There's one more bug with Flipper-Folly that prevents RN 0.68.x from being completely compatible with MacCatalyst, but it's another story.

just to ensure we won't forget about this: does an issue in a repo (either this one or the folly one or the rn one) track this separate issue?

exotexot commented 2 years ago

There's one more bug with Flipper-Folly that prevents RN 0.68.x from being completely compatible with MacCatalyst, but it's another story.

Could you please elaborate? I'm just about to update my RN app to the latest rn versions and I do need MacCatalyst support here. Which issues are still pending, preventing one to fully work, develop, build, and/or publish in App Store?

Arkkeeper commented 2 years ago

It was mentioned here https://github.com/realm/realm-js/issues/4488 along with my temporary dirty fix.

Today I'm going to test it thoroughly on RN 0.69-rc1. If it persists, I'll publish details to the 0.69 discussion.

mikehardy commented 2 years ago

Very interesting @Arkkeeper - just deep linking the actual comment since I am here anyway and have it handy, appears to be based on some sort of SharedMutex divergence between FlipperFolly and RCT-Folly https://github.com/realm/realm-js/issues/4488#issuecomment-1114718573

Arkkeeper commented 2 years ago

@mikehardy Fortunately, I can confirm that the mentioned issue isn't relevant for 0.69-rc1 because of newer versions of RCT-Folly and Flipper-Folly. As for now, everything seems ok. I've got this on 0.69-rc1 too 😞

Anyway, I'm going to PR some fixes for 0.69, so it would work with MacCatalyst out of the box.

mikehardy commented 2 years ago

I think the cocoapods version updates are already in process for cherry-picking to 0.69, if that's what you mean but if it's something else, you'll obviously know better :-)

Here's what I see in the pick list for 0.69.0-rc.2, the first one is the pod version bump commit

Picks for 0.69.0-rc.2
https://github.com/facebook/react-native/commit/d493f45bd9e39de5f60fa2ee20e229afe5a64159

Bump Hermes (https://github.com/facebook/hermes/commit/5244f819b2f3949ca94a3a1bf75d54a8ed59d94a)
Arkkeeper commented 2 years ago

Could you please elaborate? I'm just about to update my RN app to the latest rn versions and I do need MacCatalyst support here. Which issues are still pending, preventing one to fully work, develop, build, and/or publish in App Store?

I've described the details here https://github.com/reactwg/react-native-releases/discussions/21#discussioncomment-2754289

@kelset two issues about Flipper-Folly in Release scheme already exist https://github.com/facebook/react-native/issues/33764, https://github.com/facebook/react-native/issues/33753, they are duplicates

I'm sorry to say that I've got this errors even on RN 0.69-rc1, trying the fresh new project.