facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.41k stars 24.25k forks source link

RCT-Folly error after upgradeing xcode Version 15.0 (15A240d) #39568

Closed techamit95ch closed 11 months ago

techamit95ch commented 1 year ago

Description

The following build commands failed: CompileC -duhrncqankvmlvaqzannliomyfdw/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RCT-Folly.build/Objects-normal/arm64/json.o /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:

Steps to reproduce

yarn react-native run-iOS

Snack, screenshot, or link to a repository

it's confidential

github-actions[bot] commented 1 year ago
:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
RalissonMattias commented 1 year ago

Same here, I need to update my native library because the ios 17 broke her and i get this the same error

HowardTangHw commented 1 year ago

https://github.com/facebook/react-native/issues/37748

It's worked for me

matthieu-alc commented 1 year ago

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

This worked for me

erickbennett commented 12 months ago

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
ryanlanciaux commented 12 months ago

Unlikely that this is an actual fix, but if I comment out line 52, it gets past this issue. (And later fails on the linker seemingly unrelated to this but I could be wrong)

soutua commented 11 months ago

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.

erickbennett commented 11 months ago

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
FarahWe commented 11 months ago

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

`

LeviWilliams commented 11 months ago

I was able to get rid of the folly build errors by rearranging my build phases, specifically moving our copepods phases up in the order

jormelCoin commented 11 months ago

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

this worked for me. Thanks

ahinkle commented 11 months ago

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

this worked for me. Thanks

Where do you unzip the old Xcode v14.3.1? I've tried the Applications folder, downloads, etc. Tried restarting (both full pc restart and Xcode restart) and it doesn't appear within the dropdown of the "Command Line Tools" field.

Screenshot 2023-10-10 at 9 08 08 AM

Thanks!

erickbennett commented 11 months ago

Unzip Xcode in applications. But you also need to download the command line tools for 14.3.1, which you can get from the Apple Developer site where you get Xcode 14.3.1. Once you download the 14.3.1 cl tools and install them, they will appear as an option in the drop down.

ahinkle commented 11 months ago

Ah, gotcha. Thanks! I think my issue is that I'm on MacOS Sonoma. Also can't install cl tools v14. Anyone find a workaround?

Screenshot 2023-10-10 at 9 28 47 AM

cipolleschi commented 11 months ago

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:

MP-OT commented 10 months ago

@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
talhauzair-28 commented 7 months ago

I have faced the same issue after upgrading XCode and Expo to Following Expo: ^50.0.7 React-Native: 0.73.4 Xcode: 15.2

Problem: I was using jsc engine instead of Hermes. Solution: Converting the JS Engine to Hermes in podfile resolved this problem.

FBRAA commented 6 months ago

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

sleekLancelot commented 5 months ago

What did it for me was to build with xcode, and after that i got an error concerning react codegen, i updated the development target for that on xcode, and subsequent builds from the terminal were successful.

tanjilMDS commented 5 months ago

After 2 days of research and trying different approaches I ended up with a solution: What I did:

but nothing worked 😪

The solution that worked for me:

chaitanya71998 commented 4 months ago

I was working to setup Xcode cloud, since ios is stating to use xcode 15 or later to build ios apps. my react native version : "0.71.7". i tried xcode 15.4 and 15.2 but for both of them build failed. which version of later xcode 15 would be helpful for this version of react native, or should definitely update react-native version?

@tanjilMDS any insights please

tanjilMDS commented 4 months ago

@chaitanya71998 I think you can try downgrading XCode to 15.1 as well. But 15.2 should do the work. Try in a new project as well to check if it builds successfully or not from xcode

AteebNoOne commented 4 months ago

Xcode 14 doesn't allow to submit the app to app store, similarly Xcode 15 is throwing RCT error, I think it's regarding this libraries

cipolleschi commented 4 months ago

Xcode 15.3 is bugged. They reimplemented the linker and it does not support weak symbols. The error presents itself when building an app using Dynamic Frameworks.

Apple must fix the issue, there is very little we can do here. Please downgrade to Xcode 15.2. That should do the trick.

AteebNoOne commented 4 months ago

I am using Xcode 15.2 still facing RCTPolly issue

qsales2022 commented 4 months ago

Xcode 15.3 is bugged. They reimplemented the linker and it does not support weak symbols. The error presents itself when building an app using Dynamic Frameworks.

Apple must fix the issue, there is very little we can do here. Please downgrade to Xcode 15.2. That should do the trick.

Xcode 15.3 is bugged. They reimplemented the linker and it does not support weak symbols. The error presents itself when building an app using Dynamic Frameworks.

Apple must fix the issue, there is very little we can do here. Please downgrade to Xcode 15.2. That should do the trick.

I am also having same issue i am using x code 15.2 and react native 0.71.8

cipolleschi commented 4 months ago

Can you create a reproducer using this template

dhruv-bindra commented 4 months ago

Anyone find a solution? Same problem here

chaitanya71998 commented 4 months ago

check this solution, after following steps in this issue solved this error. specifically following these two steps step1: step2

AnshulRaghav commented 3 months ago

For me, this issue occurred when I updated Xcode from version 14 to 15. After days of debugging, I discovered that the problem was due to Expo. First, I removed all packages and references related to Expo from the iOS folder. After doing this, the project was built successfully.

Then, I progressively added the updated Expo and its related packages back into the project.