Closed HarryGwinnell closed 3 years ago
Thanks for this great fix. I modified your
find_and_replace
function so the fix only applies on first install (otherwise with everypod install
the fix adds anotherfolly::
prefix like thisfolly::folly::atomic_notify_one(state)
):# Define find-and-replace function def find_and_replace(dir, findstr, replacestr) Dir[dir].each do |name| text = File.read(name) replace = text.gsub(findstr,replacestr) replaced = text.index(replacestr) if replaced == nil && text != replace puts "Fix: " + name File.open(name, "w") { |file| file.puts replace } STDOUT.flush end end Dir[dir + '*/'].each(&method(:find_and_replace)) end
Thanks! That's a good suggestion. I hadn't noticed the issue mainly because of file permissions interfering with the replace after the first run - it never seems to be able to rewrite to the same file again. Every time I've run pod install
since adding the fix I've had to rm -rf Pods
first to get it to work, which negated the need for your tweak - so it's definitely something to keep in mind for those that don't get the permissions error.
Thanks for this great fix. I modified your
find_and_replace
function so the fix only applies on first install (otherwise with everypod install
the fix adds anotherfolly::
prefix like thisfolly::folly::atomic_notify_one(state)
):# Define find-and-replace function def find_and_replace(dir, findstr, replacestr) Dir[dir].each do |name| text = File.read(name) replace = text.gsub(findstr,replacestr) replaced = text.index(replacestr) if replaced == nil && text != replace puts "Fix: " + name File.open(name, "w") { |file| file.puts replace } STDOUT.flush end end Dir[dir + '*/'].each(&method(:find_and_replace)) end
Thanks! That's a good suggestion. I hadn't noticed the issue mainly because of file permissions interfering with the replace after the first run - it never seems to be able to rewrite to the same file again. Every time I've run
pod install
since adding the fix I've had torm -rf Pods
first to get it to work, which negated the need for your tweak - so it's definitely something to keep in mind for those that don't get the permissions error.
Where is the content of this file?
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:## Fix for Flipper-Folly on iOS 14.5 find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h", "atomic_notify_one(state)", "folly::atomic_notify_one(state)") find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h", "atomic_wait_until(&state, previous | data, deadline)", "folly::atomic_wait_until(&state, previous | data, deadline)")
You'll also need to add the function def for this
find_and_replace
function:def find_and_replace(dir, findstr, replacestr) Dir[dir].each do |name| text = File.read(name) replace = text.gsub(findstr,replacestr) if text != replace puts "Fix: " + name File.open(name, "w") { |file| file.puts replace } STDOUT.flush end end Dir[dir + '*/'].each(&method(:find_and_replace)) end
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:
post_install do |installer| flipper_post_install(installer) ## Fix for XCode 12.5 & RN 0.62.2 - See https://github.com/facebook/react-native/issues/28405 find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm", "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules") find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm", "RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))") ## Fix for Flipper-Folly on iOS 14.5 find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h", "atomic_notify_one(state)", "folly::atomic_notify_one(state)") find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h", "atomic_wait_until(&state, previous | data, deadline)", "folly::atomic_wait_until(&state, previous | data, deadline)") end
This is great! Although now Xcode is throwing this error during the build
Undefined symbol: Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)
I've tried:
@omer921 I have seen this once, but a npx react-native-clean-project
set me right. When bumping react-native versions or playing with node_modules like we are here while trying to find a good+clean-ish+releasable solution a lot of cleaning is required on my machines at least. Hope this helps
@sunnylqm I have reported you for harassing behavior, specifically
Unconstructive commenting behavior, no attention to issue at all, just demeaning maintainers
This issue is frustrating of course, but personal attacks are not okay. We can do better.
Having the same issue as @omer921
Added the post install script and it seems to run fine and solve that problem. BUT... This appears https://stackoverflow.com/questions/66019068/event2-event-config-h-file-not-found
and after
use_flipper!({ 'Flipper-Folly' => '2.3.0' })
pod update
pod install
I'm facing
Undefined symbols for architecture x86_64:
"Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from:
generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libMixpanel-swift.a(AutomaticProperties.o)
ld: symbol(s) not found for architecture x86_64
which seems an incompatibility with mixpanel
T_T
@mikehardy I really appreciate the help. Unfortunately the issue still persists. I also tried to manually remove all my node_modules and reinstall them.
@mikehardy So where can I report for "Unconstructive behavior from maintainers"?
The community reported months ago, also have given the reason, the fix. But these deps are deep core deps, shouldn't some one from the core team to put some effort on this issue other than some "outsiders" ? Almost 2 months has passed and it succeed to break everyone's work and waste everyone's time. Who can do better
? What else should the community do? Give more love and keep those core members free from criticize? @mikehardy
@sunnylqm Unless a fix is associated with the words "I've raised PR <link>
to the repo" to implement this idea it's not a fix, it's an idea. So unless I or anyone has done that, we can do better. That's open source. There never was a PR, there was nothing to cherry-pick anywhere, just an idea here. Unless I missed a PR link here somewhere?
Criticism of process seems well within bounds, but I chose a specific word that applied to your comments: they were demeaning. I won't debate it further with you, my word choice was correct and your comment was harassment. As I mentioned the first time: This issue is frustrating of course, but personal attacks are not okay. We can do better.
I'm looking into this from the RN side. Based on all the comments above (thank you, very helpful), it looks like we just need to bump our deps on Flipper-Folly and RCT-Folly, and then fix whatever build issues pop up from that. I'll probably land these changes to master first, and then update the 0.64 release branch.
@PeteTheHeat Thanks so much...in advance already. Just for planning purposes, will there be a patch release as well 0.63.5? Or will we be forced to upgrade to 0.64.x to get the benefit of a release, as opposed to the wonderful 🎉 temporary workaround? Needless to say, really grateful for the workaround in the Podfile @PottyZA
@mikehardy Read your words and think about it, since when the open source is working like a bureaucracy? The maintainer's only job is to approve and cherry pick like a boss? There is a Chinese saying "in your position, do your job", if I am the one who maintain the code, do I have the responsibility to look into a breaking issue and give an official way in an official position? I won't blame anyone if there is a banner in react-native's readme saying "maintainers wanted" or it has been donated to some open source foundation. I remember there are some full time maintainers from fb right? If they only care about their own interest not others, isn't they "do not care since it's running fine on my machine"? Are they doing a good job in the open source position? This is the first time I say something like this in open source. I am no body but I feel I have the responsibility to push, in my way, sometimes. (Or is there a guideline for criticism?)
@sunnylqm I feel for and agree with your frustration. I believe it is our responsibility to make sure these urgent things get seen through. For the last day this has been my #1 priority, trying to find someone on the team who can help.
In the meantime, the best we could do is help the community investigate. Interestingly enough, Folly upgrades to React Native have always been done by the community, we actually have very limited idea how that integration works. And there isn't really a Folly team at FB to help.
We are thankfully in a better place now though. @priteshrnandgaonkar from Flipper, and @PeteTheHeat from React Native have jumped in and are working to resolve this.
I also agree that we shouldn't have gotten into this situation to begin with. This issue was reported during the Xcode Beta but we hadn't seen, or at least prioritized this issue until it became critical. Once this issue is resolved, I expect us to look back and figure out how to be more on top of these things in the future. Please be patient with us as we get there.
I can confirm nuking Podfile.lock (or updating in a cleaner way Flipper folly to 2.5.3) fixes build, thanks @TheSavior @PeteTheHeat @priteshrnandgaonkar 💯 , you guys can remove all the workaround above :)
First of thanks for the info @TheSavior (name checks out btw)
@Titozzz How did you specify version for the flipper folly version? I've tried to to remove podfile.lock / cleaning the project and reinstalling. but most flipper-folly
version are (2.5.2)
or (~> 2.5)
in my podfile.lock are installing again. Could you share how you managed to fix it?
Having the same issue as @omer921 and @maurovisintin but for arm64 architecture on a different Analytics library
Undefined symbols for architecture arm64:
"Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from:
generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libBNFMatomo.a(Device.o)
ld: symbol(s) not found for architecture arm64
Have any of you encountered this or managed to solve it?
Using use_flipper!({ 'Flipper-Folly' => '2.5.3' })
works fine without hermes.
With hermes enabled it will still have the error.
/ios/Pods/Headers/Private/RCT-Folly/folly/synchronization/DistributedMutex-inl.h:1051:5: 'atomic_notify_one<unsigned long>' is unavailable
folly::
will allow the build to succeed but the debuggers will not funtion.
Having the same issue as @omer921
Added the post install script and it seems to run fine and solve that problem. BUT... This appears https://stackoverflow.com/questions/66019068/event2-event-config-h-file-not-found
and after
use_flipper!({ 'Flipper-Folly' => '2.3.0' })
pod update
pod install
I'm facing
Undefined symbols for architecture x86_64: "Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from: generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libMixpanel-swift.a(AutomaticProperties.o) ld: symbol(s) not found for architecture x86_64
which seems an incompatibility with mixpanel
T_T
+1 Same issue after updating to 2.5.3
Having the same issue as @omer921 Added the post install script and it seems to run fine and solve that problem. BUT... This appears https://stackoverflow.com/questions/66019068/event2-event-config-h-file-not-found and after
use_flipper!({ 'Flipper-Folly' => '2.3.0' })
pod update
pod install
I'm facingUndefined symbols for architecture x86_64: "Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)", referenced from: generic specialization <serialized, Swift._ArrayBuffer<Swift.Int8>> of Swift._copyCollectionToContiguousArray<A where A: Swift.Collection>(A) -> Swift.ContiguousArray<A.Element> in libMixpanel-swift.a(AutomaticProperties.o) ld: symbol(s) not found for architecture x86_64
which seems an incompatibility with mixpanel T_T
+1 Same issue after updating to 2.5.3
Take a look at your Library Search Path
(Project > Build Settings). I found that my project was compiled with Swift 5.0, when I removed the reference to the Swift 5.0 compiler in Library Search Path
, the default one was choosen Swift 5.1, and all the missing stuff disapeared ;)
Take a look at your
Library Search Path
(Project > Build Settings). I found that my project was compiled with Swift 5.0, when I removed the reference to the Swift 5.0 compiler inLibrary Search Path
, the default one was choosen Swift 5.1, and all the missing stuff disapeared ;)
@adrienlavmatters Thanks for the suggestion, although I am unable to find the reference to the Swift 5.0 compiler. Was wondering if you could please elaborate on what we should remove.
Take a look at your
Library Search Path
(Project > Build Settings). I found that my project was compiled with Swift 5.0, when I removed the reference to the Swift 5.0 compiler inLibrary Search Path
, the default one was choosen Swift 5.1, and all the missing stuff disapeared ;)@adrienlavmatters Thanks for the suggestion, although I am unable to find the reference to the Swift 5.0 compiler. Was wondering if you could please elaborate on what we should remove.
Go in your project.pbxproj file and delete the lines referencing swift 5.0 in the library search paths (there should be 2 occurrences in the file) :
Just tried and and it finally worked
Wow, #31441 (comment) seems work. He suggested to patch
{project-name}/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h
asbut i also patched
{project-name}/ios/Pods/RCT-Folly/folly/synchronization/DistributedMutex-inl.h
same way. too. After patched these two files, it worked like a charm with Hermes, React Native 0.64, Xcode 12.5. Without any extra thing. Thanks @robbiemccorkell and also @j2teamlbh , I moved screenshot here, can be seen in pinned issue.
it doesn't help me, i don't see rct-folly error anymore, but i got new some, now i have these errors:
help me, i can't make build for ios for 2 days already, and i have no idea what me to do, workarounds about this problem dont help me
@AlixH can you share your podfile ?
Can anyone tell me what things I currently need to change/update to make my app compile ?
Wow, #31441 (comment) seems work. He suggested to patch
{project-name}/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h
asbut i also patched
{project-name}/ios/Pods/RCT-Folly/folly/synchronization/DistributedMutex-inl.h
same way. too. After patched these two files, it worked like a charm with Hermes, React Native 0.64, Xcode 12.5. Without any extra thing. Thanks @robbiemccorkell and also @j2teamlbh , I moved screenshot here, can be seen in pinned issue.it doesn't help me, i don't see rct-folly error anymore, but i got new some, now i have these errors:
help me, i can't make build for ios for 2 days already, and i have no idea what me to do, workarounds about this problem dont help me
Have you tried the fix @omer921 and I discuss here https://github.com/facebook/react-native/issues/31179#issuecomment-829226170 ?
@AlixH can you share your podfile ?
I can tell I upgraded to RN 0.64 and the flipper part is like this
Okay so it seems like updating the RTC Folly library manually fixed the issue as suggested here. But if we update the pods it will break again right ?
I've landed a fix for this issue in master https://github.com/facebook/react-native/commit/36b58a824ea20daa22fe7c528a3bf0ff4e6a4cb5
@kelset is looking into patching 0.64 (I'm not sure about 0.63, if there's enough demand, it's probably worth it)
@maurovisintin @AlixH @alersenkevich - were you all able to move past the (potential) Swift versioning error?
Undefined symbol: Swift._ArrayBuffer._copyContents(initializing: Swift.UnsafeMutableBufferPointer<A>) -> (Swift.IndexingIterator<Swift._ArrayBuffer<A>>, Swift.Int)
Also, are you each using Mixpanel as well? It appears within some of the error texts, and it looks like the Mixpanel team has been made aware over here.
Was just curious if you'd had any luck otherwise, and if you'd all upgraded to RN 0.64 if you were able to find a fix
Cheers!
Thank you to everyone working hard on this issue
I make it work, through xcode but not through cli with this 3 updates in my podfile:
platform :ios, '11.0'. <------------ Updated this
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
text = File.read(name)
replace = text.gsub(findstr,replacestr)
replaced = text.index(replacestr)
if replaced == nil && text != replace
puts "Fix: " + name
File.open(name, "w") { |file| file.puts replace }
STDOUT.flush
end
end
Dir[dir + '*/'].each(&method(:find_and_replace))
end
def add_permissions_pods!
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
end
def add_maps_pods!
rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/googlemaps/google-maps-ios-utils.git', :commit => 'd5ca417617170b9a0e4e83964e961bfaf9b26f1f'
end
def add_zendesk_pods!
pod 'ZendeskChatProvidersSDK', '2.8.0'
pod 'ZendeskChatSDK', '2.8.0'
end
# Post Install processing for Flipper
def flipper_post_install(installer)
file_name = Dir.glob("*.xcodeproj")[0]
app_project = Xcodeproj::Project.open(file_name)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '
unless cflags.include? '-DFB_SONARKIT_ENABLED=1'
puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'
cflags << '-DFB_SONARKIT_ENABLED=1'
end
config.build_settings['OTHER_CFLAGS'] = cflags
end
app_project.save
end
installer.pods_project.save
end
def base_pods
# Base react pods
end
target 'Test' do
# Pods for Test
base_pods
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
add_maps_pods!
add_permissions_pods!
add_zendesk_pods!
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
end
target 'Test-Staging' do
# Pods for Test
base_pods
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
add_maps_pods!
add_permissions_pods!
end
target 'Test-Develop' do
# Pods for Test
base_pods
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
add_maps_pods!
add_permissions_pods!
end
target 'Test-Qa' do
# Pods for Test
base_pods
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
add_maps_pods!
add_permissions_pods!
end
def iterable_post_install(installer)
installer.pods_project.targets.each do |target|
if ['Iterable-iOS-SDK', 'Iterable-React-Native-SDK'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
end
end
end
end
def zendeskchat_post_install(installer)
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
# Added Flipper 0.80.0 to avoid this error: https://stackoverflow.com/questions/66019068/event2-event-config-h-file-not-found
use_flipper!({ 'Flipper' => '0.80.0' }) <------------ Updated this
post_install do |installer|
flipper_post_install(installer)
iterable_post_install(installer)
zendeskchat_post_install(installer)
<------- Added this lines ----------->
## Fix for XCode 12.5 & RN 0.62.2 - See https://github.com/facebook/react-native/issues/28405
find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
"_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
"RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")
## Fix for Flipper-Folly on iOS 14.5
find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
"atomic_notify_one(state)", "folly::atomic_notify_one(state)")
find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
"atomic_wait_until(&state, previous | data, deadline)", "folly::atomic_wait_until(&state, previous | data, deadline)")
<------- /Added this lines ----------->
end
There are a few issues at play here, and I think it's important to untangle them. It took me a whole day to sort all this out, so I hope it helps someone else.
For this, @PottyZA's patch works, except that it isn't idempotent. So if you run pod install multiple times, it will keep adding folly:: as a prefix to atomic_notify_one and atomic_wait_until. I "fixed" that by using " atomic_wait_until" and " atomic_notify_one" in find_and_replace. Note the leading spaces. Is it hacky? Yes. Did it do the trick? Yes.
This one is discussed here: https://github.com/facebook/react-native/issues/30836. It's another issue arising from a different version of folly being imported into Flipper. Apply the patch noted in that issue.
This requires you to remove both references to "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)" from your project.pbxproj file. You need to have a Swift bridging header and also an empty swift file in your target. I had only the bridging header and not an actual Swift file, which used to work fine, but for some reason didn't suffice any more. I explicitly added an empty Swift file, and that fixed all linking issues. It looks like adding that file simply helped set ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to YES. You could also try setting this directly.
In my experience with RN, this usually requires some combination of magical incantations to resolve. I don't know which one helps in which case, so I just piled them all into one script. Run this, and then see if your app runs properly:
#!/usr/bin/env bash
echo "Cleaning all the things";
watchman watch-del-all;
rm -rf node_modules;
rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/npm-*
cd ios
rm -rf Pods;
rm -rf Podfile.lock;
rm -rf build;
npm cache clean --force
pod cache clean --all
cd ../android
rm -rf build
cd ..
rm -rf ~/Library/Developer/Xcode/DerivedData
echo "Installing things again";
npm install;
cd ios
pod install
cd ..;
npm start -- --reset-cache;
Stepping back a bit, I wonder what could be done to make issues like this less painful. I definitely see this happening again with future XCode updates. Couple of quick thoughts:
Thanks again to everyone that dug into this, as well as my former colleagues at FB who jumped in to help!
I've landed a fix for this issue in master 36b58a8
@kelset is looking into patching 0.64 (I'm not sure about 0.63, if there's enough demand, it's probably worth it)
A patched version 0.63 would be pretty helpful - is there anything I can do to support this effort?
(And I forgot to say: Thanks for your help and support here 😊 )
@smadan big-time help, thanks a ton. Without overthinking it too much, your third step was what unstuck me.
Manually removing those swift-5.0 references, as well as adding an empty swift file (and accepting the creation of a bridging header) did the trick.
Interestingly enough, I had removed the swift-file/header previously like you mentioned as well. I'm curious why that would come back and like you mentioned, if this will be a recurring pattern.
@ca057 - I'm on 0.63.3. at the moment
Edit: As well, to the wizards/sages who understand all the behind-the-scenes workings as to what's going on and your support is immensely appreciated - I'm still getting into the RN space and a lot of this is over my head outside of generic troubleshooting paths. Big ups all around.
Thanks for all the hard work on this ticket 🥇 , and in particular working to release it for both 0.64.x
and 0.63.x
.
While the post install script workaround works nicely in local dev, in our Circle CI it fails in the iOS related build-deploy step due to a permissions issues (which could be temporarily addressed). So a proper patch release would be most appreciated, so we avoid further domino effects to get a clean deployment path. 🙇
@smadan - you're summary is fantastic! 2 thoughts
I'm not sure there is an automated way. All of the github actions (like https://github.com/maxim-lobanov/setup-xcode) that select Xcode versions rely on pre-installed ones, and those don't include betas https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11.0-Readme.md#xcode - in fact 12.4 is still the default.
Are there any CI providers that provide regular access to betas with a label for automation, like "next" or something? CircleCI seems to maybe have them but with no specifics on versions https://circleci.com/docs/2.0/xcode-policy/#beta-image-support
So, unsure if this can be automated
npx react-native-clean-project
then try again...I'm not sure there is an automated way. All of the github actions (like https://github.com/maxim-lobanov/setup-xcode) that select Xcode versions rely on pre-installed ones, and those don't include betas
I was suggesting that the maintainers (ie. Facebook, my former employer) take on this role and proactively upgrade this repo as soon as they discover breaking changes internally. Pretty sure they use the latest and greatest XCode beta versions internally as soon as they can. That said, I never worked on open source projects while I was there so I can't speak to how feasible this would be for them to do in practice.
react-native-clean-project
Looks great! I'll try it.
So to add a little insult to injury 😉 , I managed to get the iOS build working with the with the post install script workaround fix for folly as mentioned earlier.
However, following up on another couple of housekeeping items we had on the project, we upgraded React Native Firebase (app, analytics, messaging) from 11.0.0 to 11.3.x and the iOS build is breaking again. (even just upgrading to 11.1.x breaks it).
The error was mentioned 3 days ago https://github.com/facebook/react-native/issues/31441#issuecomment-827607052 already.
I. e. now the compilation error hits FlipperRSocketResponder
. And as mentioned in the same comment just commenting out useflipper!
and flipper_post_install(installer)
to get by until a fix is available, just leads to compilation breaking in AppDelegate.m
So for now had to go with #ifndef FB_SONARKIT_ENABLED
wherever the AppDelegate.m
contained #ifdef FB_SONARKIT_ENABLED
Update on the fix: it doesn't work when Hermes is enabled. I spent the afternoon trying to fix it, but was unsuccessful, will try again tomorrow. Hermes uses folly futures, which isn't compiling with the updated version of folly I bumped in https://github.com/facebook/react-native/commit/36b58a824ea20daa22fe7c528a3bf0ff4e6a4cb5. It's quite tricky mapping folly BUCK files to the cocoapods podspec needed here.
Edit: https://github.com/facebook/react-native/commit/8eceee744ed9fee1eb2402f6b13bb606f6046f62 fixes the build when Hermes is enabled (on master).
I was suggesting that the maintainers (ie. Facebook, my former employer) take on this role and proactively upgrade this repo as soon as they discover breaking changes internally.
This normally happens. We have internal tests running on beta Xcode versions, and push fixes to master before they ever become an issue. The problem here is that internally, we use folly built from master, so never hit this issue.
Hey folks- thanks for all your comments, me and a colleague of mine are trying to figure out a way to fix this for 0.64/0.63/0.62 but can't make promises right now.
It's a really weird issue that needs to be properly tested - after a couple hours banging our heads I think we have an idea of how to patch the different versions.
I'll update y'all asap, in the mean time I just want to thank in particular @smadan for your great write up here https://github.com/facebook/react-native/issues/31179#issuecomment-829536845
thanks to all of you i can set up build for ios with these steps:
1) update rct-folly 2) remove refrence to swift 5.0 from LIBRARY_SEARCH_PATHS 3) set bridging header
thanks to all of you i can set up build for ios with these steps:
- update rct-folly
- remove refrence to swift 5.0 from LIBRARY_SEARCH_PATHS
- set bridging header
This works with hermes enabled?
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:
use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
"react-native": "0.62.2"
to:
"react-native": "facebook/react-native#c6f4611dcbfbb64d5b54e242570e2a1acffcabef"
yarn install
and a pod 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, you are in luck! You just need to add this line to your podfile (or modify it if you already had it):
use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
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.
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:
use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
"react-native": "0.64.0"
to:
"react-native": "facebook/react-native#cf8a364767df830d7255339741350bb53ab1a68a"
yarn install
and a pod 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.
@kelset Thanks to you and everyone else who is working on the fix(es).
I can confirm that the
If you are on 0.63, you are in luck!
is indeed true 😄
I backed out all the various workarounds and simply added the proposed version pinning, and it builds without issues.
For reference:
System:
OS: macOS 11.3
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 31.01 GB / 64.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.10.0 - /var/folders/kb/0gc38wkn40bb3513d34xdym40000gp/T/yarn--1619799916336-0.2452634886783127/node
Yarn: 1.22.5 - /var/folders/kb/0gc38wkn40bb3513d34xdym40000gp/T/yarn--1619799916336-0.2452634886783127/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.10.0/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: 4.1 AI-201.8743.12.41.7042882
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: javac 15 - /usr/bin/javac
Python: 3.8.3 - /opt/anaconda3/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.4 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Bought a new mac this morning just so I could build on iOS instead of Android. Spent all day trying to make it work. After 12 hours of trying, no build is possible. Latest version of everything which I understand is the problem.
Bought a new mac this morning just so I could build on iOS instead of Android. Spent all day trying to make it work. After 12 hours of trying, no build is possible. Latest version of everything which I understand is the problem.
Did you buy a mac with the new m1 chip? Run your project with Rosetta. Right click Xcode icon -> Get info -> check Rosetta and run Xcode again.
@kelset thank you, I spent some time resolving it.
Don't use Legacy Build System.
I will hope for a quick fix flipper.
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):
use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3')
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.
Thanks for the workaround @kelset!
In case it's helpful for anyone else hitting the same additional stumbling block I just hit: I also needed to specify an appropriate Flipper-RSocket version in my Podfile to satisfy Flipper 0.75.1's dependencies.
use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '~> 1.3')
(I fully acknowledge that the fact this was necessary for me could be symptomatic of some other quirk in my setup, but figured I'd share anyway :P)
@kelset
"react-native": "facebook/react-native#c6f4611dcbfbb64d5b54e242570e2a1acffcabef"
this work on ios but android doesn't work
EDIT (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.Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
cd testApp
yarn install
thencd iOS & pod install
cd ../ & yarn ios
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