react-native: RCT-Folly error after upgradeing xcode Version 15.0 (15A240d)

Description

The following build commands failed: CompileC <LOCATION>-duhrncqankvmlvaqzannliomyfdw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/arm64/json.o <LOCATION>/ios/Pods/RCT-Folly/folly/json.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target ‘RCT-Folly’ from project ‘Pods’) (1 failure)

React Native Version

0.72.4

Output of npx react-native info

System: OS: macOS 13.5.2 CPU: (8) arm64 Apple M1 Pro Memory: 105.25 MB / 16.00 GB Shell: version: “5.9” path: /bin/zsh Binaries: Node: version: 18.17.1 path: /opt/homebrew/bin/node Yarn: version: 3.6.3 path: ~/node_modules/.bin/yarn npm: version: 9.6.7 path: /opt/homebrew/bin/npm Watchman: version: 2023.08.14.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /opt/homebrew/opt/ruby/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 23.0 - iOS 17.0 - macOS 14.0 - tvOS 17.0 - watchOS 10.0 Android SDK: API Levels: - “23” - “29” - “30” - “31” - “32” - “33” Build Tools: - 29.0.0 - 29.0.1 - 29.0.2 - 29.0.3 - 30.0.0 - 30.0.1 - 30.0.2 - 30.0.3 - 31.0.0 - 32.0.0 - 32.1.0 - 33.0.0 System Images: - android-29 | Intel x86 Atom_64 - android-29 | Google APIs ARM 64 v8a - android-29 | Google APIs Intel x86 Atom - android-30 | Intel x86 Atom_64 - android-30 | Google APIs ARM 64 v8a - android-30 | Google APIs Intel x86 Atom - android-31 | Intel x86 Atom_64 - android-32 | Google APIs ARM 64 v8a - android-32 | Google APIs Intel x86 Atom_64 - android-32 | Google Play ARM 64 v8a - android-32 | Google Play Intel x86 Atom_64 - android-33 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10671973 Xcode: version: 15.0/15A240d path: /usr/bin/xcodebuild Languages: Java: version: 11.0.20 path: /usr/bin/javac Ruby: version: 3.2.2 path: /opt/homebrew/opt/ruby/bin/ruby npmPackages: “@react-native-community/cli”: Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.4 wanted: 0.72.4 react-native-macos: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: false newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

Steps to reproduce

yarn react-native run-iOS

Snack, screenshot, or link to a repository

it’s confidential

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 23
  • Comments: 24 (2 by maintainers)

Most upvoted comments

Hi there! Please:

  1. make sure that you are calling the react_native_post_install hook in your Podfile’s post_install_hook. Like this
  2. Please invoke the __apply_Xcode_12_5_M1_post_install_workaround as shown above.
  3. update to React Native 0.72.6.

We released a new version of React Native this week that should address all these problems:

If you don’t need xcode Version 15.0 you can downgrade to previous version :

  • Go to https://developer.apple.com/download/all/ and download previous Xcode version (14.3.1 at the moment).
  • Unzip it
  • Open Xcode > Settings > Locations, and select the downloaded version in Command Line Tools field (if you don’t see the downloaded version try close an reopen Xcode)
  • Optionally check the output of npx react-native info => You should see Xcode: 14.3.1 in the IDEs section
  • Exit the settings and now try again to launch yarn react-native run-iOS

This worked for me

I Just run the project at xcode, crashed and after that xcode suggested me to fix a line at file hash.hpp.

This is what a changed!

#else template <typename T> struct hash_base : std::__unary_function<T, std::size_t> {}; #endif

This is the code what crashed before

#else template <typename T> struct hash_base : std::unary_function<T, std::size_t> {}; #endif

Also encountered this issue and the fix was to add __apply_Xcode_12_5_M1_post_install_workaround(installer) in the post_install step of the Podfile. We had left that out at some point since it didn’t seem necessary before, but now it looks like it’s required.

Good call. That helped resolve the issue for me. I needed that 12_5 fix and the 14_3.

Here’s what I added to my pod file:

-before your project and target-

def __apply_Xcode_14_3_RC_post_install_workaround(installer)
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
      current_target = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
      minimum_target = min_ios_version_supported
      if current_target.to_f < minimum_target.to_f
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_target
      end
    end
  end
end

-here’s what the post installer looks like-

 post_install do |installer|
    react_native_post_install(installer, config[:reactNativePath],
    :mac_catalyst_enabled => false)
    
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
    __apply_Xcode_14_3_RC_post_install_workaround(installer)
  end

Getting a similar RTC-Folly error. Xcode 15 with RN 0.72.5. Xcode says the error is in Folly/Time line 52, see screen. Error was occurring on RN 0.71.7 as well. Upgraded RN in an attempt to troubleshoot the issue.

RCT-Folly/folly/portability/Time.h:52:17

“Typedef redefinition with different types (‘uint8_t’ (aka ‘unsigned char’) vs ‘enum clockid_t’)”

rtc-folly-xcode15-error

@techamit95ch Based on https://github.com/facebook/react-native/issues/37748 I’ve created this def in my podfile:

def __xcode_15_workaround(installer)
  xcode_version_output = `xcodebuild -version`
  xcode_version_match = xcode_version_output.match(/Xcode (\d+(\.\d+)?)/)

  if xcode_version_match
    xcode_version = Gem::Version.new(xcode_version_match[1])
    if xcode_version >= Gem::Version.new('15.0')
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
        end
      end
    end
  end
end

You can use it in the post_install script like this:

  post_install do |installer|
    #.... other configs
    
    # Call the Xcode 15 workaround function
    __xcode_15_workaround(installer)

   #.... other configs
  end

Hi there! Please:

  1. make sure that you are calling the react_native_post_install hook in your Podfile’s post_install_hook. Like this
  2. Please invoke the __apply_Xcode_12_5_M1_post_install_workaround as shown above.
  3. update to React Native 0.72.6.

We released a new version of React Native this week that should address all these problems:

still getting the same issue with all beforementioned invocations on latest x-code with RN 0.72.6