New RN project will not build on Xcode 12.5 Beta 3
See original GitHub issueEDIT (by @kelset): Please read the current status of things at this comment.
Description
Running the latest Xcode/React Native etc. Upgrading an existing project failed so I tested with a new RN project (npx react-native init TestApp --version 0.64.0 --template react-native-template-typescript). It will build and run under Xcode 12.4, but fails when attempting to build with Xcode 12.5 Beta 3 (12E5244e). It’s unlikely to be relevant, but the app is targeting an iPhone 12 Simulator running iOS 14.5
React Native version:
Run react-native info
in your terminal and copy the results here.
System:
OS: macOS 11.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 224.71 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 15.11.0 - /var/folders/5h/g6n2qyx9781c5lwqmms28gw80000gn/T/yarn--1615999118104-0.9813238427222761/node
Yarn: 1.22.10 - /var/folders/5h/g6n2qyx9781c5lwqmms28gw80000gn/T/yarn--1615999118104-0.9813238427222761/yarn
npm: 7.6.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 12.5/12E5244e - /usr/bin/xcodebuild
Languages:
Java: javac 14 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
✨ Done in 15.64s.
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Install the above tools, Xcode 12.5 Beta 3, RN 0.64.0 etc.
- Create a new app (npx react-native init TestApp --version 0.64.0 --template react-native-template-typescript)
cd testApp
yarn install
thencd iOS & pod install
cd ../ & yarn ios
- This error also appears if you replace step 4 with launching Xcode.app and building the app that way
Expected Results
Describe what you expected to happen.
A successful build of the example app, running on the simulator.
Snack, code example, screenshot, or link to a repository:
Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve
The following build commands failed: CompileC /Users/harrygwinnell/Library/Developer/Xcode/DerivedData/testApp-hgqgknryyegjzjbbjfnfzrcyijmv/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/DistributedMutex.o /Users/harrygwinnell/Desktop/Git.nosync/testApp/testApp/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (1 failure)
This is the error that comes from yarn ios
. A similar error comes from Xcode.app, reporting an error building flipper-folly.
Full console output available on request, but it was too big for pastern.
Xcode.app output is below
Issue Analytics
- State:
- Created 3 years ago
- Reactions:72
- Comments:126 (20 by maintainers)
Top GitHub Comments
Hey folks - here’s the update on this issue.
First off, let me put my hands forward: we will not be doing a release today. It’s Friday afternoon and the next day me and/or @grabbou are available is Wednesday, so it’s not safe to roll out something with the risk of making the life of everyone harder than it is today.
THAT SAID: me and @tido64 spent the entire day trying to localize (and test) viable fixes and I think we got pretty much to the bottom of this - and we need your help to verify that that’s the case.
So, to test our fixes:
If you are on 0.62
to:
yarn install
and apod install --repo-update
(if pod install fails on an error about a Flipper package, just remove the relevant lines from the podfile.lock and run the pod install again)This should allow you to correctly build RN on Xcode 12.5. Just remember that because you are pointing to an react-native hash (which in this case corresponds to the latest local commit on the
0.62-stable
branch), it will make your Android side not work! So, do the changes, test them, then rollback! If Xcode 12.5 build correctly, that’s great and we mean that next week we can do a patch release of 0.62!If you are on 0.63
If you are on 0.63, you are in luck! You just need to add this line to your podfile (or modify it if you already had it):
Then properly clean your caches (react-native-clean-project is your ally), remove pods folder and do a
pod install --repo-update
.This should be enough for you to get Xcode 12.5 to work.
If you are on 0.64
On 0.64 is when Hermes comes into play, so the process closer to 0.62 - please test this with both Hermes ON and Hermes OFF:
to:
yarn install
and apod install --repo-update
(if pod install fails on an error about a Flipper package, just remove the relevant lines from the podfile.lock and run the pod install again)This should allow you to correctly build RN on Xcode 12.5. Just remember that because you are pointing to a react-native hash (which in this case corresponds to the latest local commit on the
0.64-stable
branch), it will make your Android side not work! So, do the changes, test them, then rollback! If Xcode 12.5 build correctly, that’s great and we mean that next week we can do a patch release of 0.64!If you are still experiencing issues, it’s likely that they are related to the Swift issue that @smadan was explaining above, so refer to that comment.
Ok folks, this is as far as me and @tido64 could go today - just to be clear: the instructions above should get you to be ✅ again in all cases, we tested them but we want a bigger sample size. Please test according to what described above and let us know - so that next week we can push out the patch releases for 0.62 and 0.64.
I’ve implemented a “automated” way of doing the above Folly patch (inspired by this comment on another issue that we were experiencing):
Add this to your
post_install
in your Podfile:You’ll also need to add the function def for this
find_and_replace
function:Run
pod install
again and it should work. If you get an error relating to permissions while accessing theDistributedMutex-inl.h
file, delete your/pods
folder and runpod install
againYou should see text print out that says
Fix: Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h
, etc. If you don’t, double check the path in thefind_and_replace
call.For others’ reference, this is what our full post install looks like now: