Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'folly/experimental/coro/Coroutine.h' file not found after upgrading to > RN 0.74 #2297

Closed
MrShakes opened this issue Sep 21, 2024 · 14 comments

Comments

@MrShakes
Copy link

Currently upgrading to RN 0.75.2 from 0.73.x and encountered the error below on IOS, downgraded to RN 0.74.5 and had the same issue.
Extensive research online seems to indicate that "folly/experimental" is deprecated and should no longer be available however it's still being called somewhere. Not completely sure if this is the issue though.
Uninstalling/removing RNBranch still gives the same error

Xcode version 15.3
Pod version 1.15.2
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin22]

❌  /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Oreille-bxxuvxrzbbojtictzbxfgyypfvxf/Build/Intermediates.noindex/ArchiveIntermediates/Oreille/BuildProductsPath/Release-iphoneos/RCT-Folly/folly.framework/Headers/folly/Optional.h:667:10: 'folly/experimental/coro/Coroutine.h' file not found
#include <folly/experimental/coro/Coroutine.h>
                                                           ^
❌  /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Oreille-bxxuvxrzbbojtictzbxfgyypfvxf/Build/Intermediates.noindex/ArchiveIntermediates/Oreille/BuildProductsPath/Release-iphoneos/RCT-Folly/folly.framework/Headers/folly/Optional.h:667:10: 'folly/experimental/coro/Coroutine.h' file not found
#include <folly/experimental/coro/Coroutine.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
❌  /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Oreille-bxxuvxrzbbojtictzbxfgyypfvxf/Build/Intermediates.noindex/ArchiveIntermediates/Oreille/BuildProductsPath/Release-iphoneos/React-RCTAppDelegate/React_RCTAppDelegate.framework/Headers/RCTAppDelegate.h:8:9: could not build module 'React'
#import <React/RCTBridgeDelegate.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
❌  /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Oreille-bxxuvxrzbbojtictzbxfgyypfvxf/Build/Intermediates.noindex/ArchiveIntermediates/Oreille/BuildProductsPath/Release-iphoneos/react-native-branch/RNBranch.framework/Headers/RNBranch.h:2:9: could not build module 'React'
#import <React/RCTBridgeModule.h>
 ~~~~~~~^
 
 The following build commands failed:
	CompileC /Users/[REDACTED]/Library/Developer/Xcode/DerivedData/Oreille-bxxuvxrzbbojtictzbxfgyypfvxf/Build/Intermediates.noindex/ArchiveIntermediates/Oreille/IntermediateBuildFilesPath/Oreille.build/Release-iphoneos/Oreille.build/Objects-normal/arm64/AppDelegate.o /Users/[REDACTED]/git/ios/Oreille/AppDelegate.mm normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'Oreille' from project 'Oreille')
(1 failure)
@MrShakes
Copy link
Author

Adding "-DFOLLY_CFG_NO_COROUTINES=1" to pbxproj solved the issue

@nezort11
Copy link

same problem, adding "-DFOLLY_CFG_NO_COROUTINES=1" to pbxproj NOT solved the issue

image

@MrShakes
Copy link
Author

@nezort11
Copy link

nezort11 commented Oct 28, 2024

yes, i have added "-DFOLLY_CFG_NO_COROUTINES=1" two times in debug and release and still same error

@nezort11
Copy link

nezort11 commented Oct 28, 2024

I'have managed to solve this error coming from Optional.h header in RCT-Folly:

  • XCode 15.3
  • ruby 2.7.5p203
  • pod 1.15.2
  • react native 0.72.13

Problem

/Users/<user>/dev/walnuts/ios/Pods/Headers/Public/RCT-Folly/folly/Optional.h:614:10
'folly/experimental/coro/Coroutine.h'
file not found

because of this code with import
./ios/Pods/Headers/Public/RCT-Folly/folly/Optional.h

image

because FOLLY_HAS_COROUTINES is 1 and there is no experimental directory in folly

Solution

Hardcode FOLLY_HAS_COROUTINES to define always to 0 (line 549)

open ./ios/Pods/RCT-Folly/folly/Portability.h
open ./ios/Pods/Flipper-Folly/folly/Portability.h
image

(potentially after this commit)

And also comment some not important assertion:

open ./ios/Pods/Headers/Public/Flipper-Folly/folly/concurrency/CacheLocality.h
image

@dylanmaryk
Copy link

Thanks @nezort11, your solution looks correct but I'm struggling to overwrite the value of FOLLY_HAS_COROUTINES when building the project on CI. Nothing is working so far. I don't have this issue locally, only on CI.

@dylanmaryk
Copy link

dylanmaryk commented Oct 29, 2024

Adding this to the Podfile works for me, as a way to automate the fix on CI:

post_install do |installer|
  system("chmod -R u+w Pods/RCT-Folly")
  Dir.glob("Pods/RCT-Folly/folly/Portability.h").each do |file|
    text = File.read(file)
    new_contents = text.gsub('#define FOLLY_HAS_COROUTINES 1', '#define FOLLY_HAS_COROUTINES 0')
    File.open(file, "w") { |file| file.puts new_contents }
  end
end

@johhansantana
Copy link

hey @dylanmaryk I've implemented the Podfile post_install script and it works locally but when using xcode cloud for example it fails with the 'folly/experimental/coro/Coroutine.h' file not found error.

/Volumes/workspace/repository/ios/Pods/Headers/Public/RCT-Folly/folly/Optional.h:614:10: fatal error: 'folly/experimental/coro/Coroutine.h' file not found #include <folly/experimental/coro/Coroutine.h>

This only happens on the CI/CD part. Do you have any clue on what could it be?

@dylanmaryk
Copy link

@johhansantana are you using the correct relative path for Pods/RCT-Folly depending on where your Podfile is located?

@p29hieu
Copy link

p29hieu commented Oct 31, 2024

hey @dylanmaryk I've implemented the Podfile post_install script and it works locally but when using xcode cloud for example it fails with the 'folly/experimental/coro/Coroutine.h' file not found error.

/Volumes/workspace/repository/ios/Pods/Headers/Public/RCT-Folly/folly/Optional.h:614:10: fatal error: 'folly/experimental/coro/Coroutine.h' file not found #include <folly/experimental/coro/Coroutine.h>

This only happens on the CI/CD part. Do you have any clue on what could it be?

I got same issue. This only happens on CI/CD. I'm using CircleCI. This is my resource

macos:
    xcode: 15.0.0
resource_class: macos.m1.medium.gen1

@johhansantana
Copy link

johhansantana commented Oct 31, 2024

@p29hieu @dylanmaryk I may have fixed it by updating the post_install script

post_install do |installer|
  # ... your other post_install scripts

  # Modify RCT-Folly Portability.h to disable coroutines
  Dir.glob(installer.sandbox.root + "RCT-Folly/folly/Portability.h") do |file|
    begin
      # First try to make the file writable
      system "chmod +w #{file}"
      
      contents = File.read(file)
      modified_contents = contents.gsub(/#define FOLLY_HAS_COROUTINES 1/, '#define FOLLY_HAS_COROUTINES 0')
      
      # Try writing with elevated privileges if needed
      if !File.writable?(file)
        system "sudo chmod +w #{file}"
      end
      
      File.write(file, modified_contents)
      
      # Optionally restore original permissions
      system "chmod -w #{file}"
    rescue => e
      Pod::UI.warn "Failed to modify Portability.h: #{e.message}"
    end
  end
end

@iainbeeston
Copy link

Upgrading to react native 0.77 fixes this for me.

0.77 updates RCT-Folly from 2024.01.01.00 to 2024.11.18.00 (here is the diff). Version 2024.11.18.00 has the missing folly/experimental/coro/Coroutine.h file.

@abejfehr
Copy link

abejfehr commented Jan 24, 2025

I upgraded to React Native 0.77 which builds fine normally, but when trying to integrate the Expo SDK with my RN app I get this:

Image

I've confirmed in my Podfile.lock that I'm on 2024.11.18.00, at least that version is present in a lot of places as a dependency like:

    - RCT-Folly (= 2024.11.18.00)

My ios/Pods/folly directory does not contain a coro folder.


I also just created a brand new RN project with:

npx @react-native-community/cli@latest init RNTest

that definitely uses RN 77, and installed cocoapods there, but there is also neither a experimental folder nor a coro folder:

~/Development/RNTest 🦄 ls ios/Pods/RCT-Folly/folly
AtomicHashArray-inl.h		DynamicConverter.h		Indestructible.h		Range.h				Uri.h
AtomicHashArray.h		Exception.h			IndexedMemPool.h		Replaceable.h			Utility.h
AtomicHashMap-inl.h		ExceptionString.h		IntrusiveList.h			ScopeGuard.cpp			Varint.h
AtomicHashMap.h			ExceptionWrapper-inl.h		Lazy.h				ScopeGuard.h			VirtualExecutor.h
AtomicIntrusiveLinkedList.h	ExceptionWrapper.h		Likely.h			SharedMutex.cpp			algorithm
AtomicLinkedList.h		Executor.h			MPMCPipeline.h			SharedMutex.h			base64.h
AtomicUnorderedMap.h		Expected.h			MPMCQueue.h			Singleton-inl.h			chrono
Benchmark.h			FBString.h			MacAddress.h			Singleton.h			concurrency
BenchmarkUtil.h			FBVector.h			MapUtil.h			SingletonThreadLocal.h		container
Bits.h				File.h				Math.h				SocketAddress.h			detail
CPortability.h			FileUtil.cpp			MaybeManagedPtr.h		SpinLock.h			dynamic-inl.h
CancellationToken-inl.h		FileUtil.h			Memory.h			String-inl.h			dynamic.h
CancellationToken.h		Fingerprint.h			MicroLock.h			String.cpp			functional
Chrono.h			FixedString.h			MicroSpinLock.h			String.h			hash
ClockGettimeWrappers.h		FollyMemcpy.h			MoveWrapper.h			Subprocess.h			json
ConcurrentBitSet.h		FollyMemset.h			ObserverContainer.h		Synchronized.h			json.h
ConcurrentLazy.h		Format-inl.h			Optional.h			SynchronizedPtr.h		json_patch.h
ConcurrentSkipList-inl.h	Format.cpp			Overload.h			ThreadCachedInt.h		json_pointer.h
ConcurrentSkipList.h		Format.h			PackedSyncPtr.h			ThreadLocal.h			lang
ConstexprMath.h			FormatArg.h			Padded.h			TimeoutQueue.h			memory
ConstructorCallbackList.h	FormatTraits.h			Poly-inl.h			TokenBucket.h			net
Conv.cpp			Function.h			Poly.h				Traits.h			observer
Conv.h				GLog.h				PolyException.h			Try-inl.h			poly
CppAttributes.h			GroupVarint.h			Portability.h			Try.h				portability
CpuId.h				Hash.h				Preprocessor.h			UTF8String.h			small_vector.h
DefaultKeepAliveExecutor.h	IPAddress.h			ProducerConsumerQueue.h		Unicode.cpp			sorted_vector_types.h
Demangle.cpp			IPAddressException.h		RWSpinLock.h			Unicode.h			stop_watch.h
Demangle.h			IPAddressV4.h			Random-inl.h			Unit.h				synchronization
DiscriminatedPtr.h		IPAddressV6.h			Random.h			Uri-inl.h			system

but there are files that reference that 🤔

~/Development/RNTest 🦄 cat ./ios/Pods/RCT-Folly/folly/Expected.h | grep /coro/
#include <folly/coro/Coroutine.h>

how is that supposed to work? I see the file present in the source for that tag, but it doesn't seem to be in my system

Edit: I've restored the Podfile patch to set FOLLY_HAS_COROUTINES 0 in Portability.h, that builds successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants