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

duplicate symbol 'folly::exception_wrapper::from_exception_ptr(std::exception_ptr&&)' React Native 0.66 with hermes enabled #32333

Closed
umang-simform opened this issue Oct 5, 2021 · 21 comments
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.

Comments

@umang-simform
Copy link

umang-simform commented Oct 5, 2021

Description

I was on 0.65.1 (with Hermes enabled) and tried to perform an upgrade to 0.66 today and after performing all necessary changes as mentioned in upgrade helper, I finally performed a clean install and tried to run the app and now it is not working anymore, It is throwing duplicate symbol errors related to flipper between RCT-folly and Flipper-folly.
Also, I faced a similar issue when I upgraded to 0.65.1 but at that time this fix worked: react-native-community/releases#235 (comment)
I tried this here but doesn't seems working
Here is the error from Xcode:

duplicate symbol 'folly::detail::str_to_bool(folly::Range<char const*>*)' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(Conv.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(Conv.o)
duplicate symbol 'folly::makeConversionError(folly::ConversionCode, folly::Range<char const*>)' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(Conv.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(Conv.o)
duplicate symbol 'folly::exception_wrapper::from_exception_ptr(std::exception_ptr&&)' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::from_exception_ptr(std::exception_ptr const&)' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::onNoExceptionError(char const*)' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exceptionStr(folly::exception_wrapper const&)' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::uninit_' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::ExceptionPtr::ops_' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::SharedPtr::ops_' in:
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/umangloriya/Library/Developer/Xcode/DerivedData/App-gafjkayoxqdgqvdjhytxqqiubosa/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
ld: 9 duplicate symbols for architecture arm64

React Native version:

Run react-native info in your terminal and copy the results here.

System:
    OS: macOS 11.6
    CPU: (8) arm64 Apple M1
    Memory: 157.19 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.0.0 - /opt/homebrew/bin/node
    Yarn: 1.22.11 - /opt/homebrew/bin/yarn
    npm: 6.14.13 - /opt/homebrew/bin/npm
    Watchman: 4.9.0 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
    Android SDK:
      API Levels: 23, 29, 30
      Build Tools: 29.0.2, 30.0.0, 30.0.2, 30.0.3
      System Images: android-30 | Google APIs ARM 64 v8a, android-S | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7678000
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.66.0 => 0.66.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Upgrade to 0.66.0 with hermes enable for iOS
    2.Build/Run the project

Expected Results

It should build/run just fine without throwing error

Snack, code example, screenshot, or link to a repository:

Here is my podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

# Override Firebase SDK Version

platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false

target 'NotificationServiceExt' do
  pod 'Firebase/Messaging'
end

target 'App' do
  # Pods for App
  pod 'libwebp', :modular_headers => true
  # Add the pod for Firebase Cloud Messaging
  pod 'Firebase/Messaging'
  config = use_native_modules!
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )
  # Enables Flipper.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end
@cuongtranduc
Copy link

I got the same error even in v0.65

@umang-simform
Copy link
Author

I got the same error even in v0.65

For 0.65 try this fix: react-native-community/releases#235 (comment)
It worked for me. but it is not working for 0.66

@samih7
Copy link

samih7 commented Oct 6, 2021

I got the same error even in v0.65

For 0.65 try this fix: react-native-community/releases#235 (comment) It worked for me. but it is not working for 0.66

Same here. Error:
ld: 9 duplicate symbols for architecture arm64

@escobar5
Copy link

escobar5 commented Oct 6, 2021

While this issue is addressed, you can disable flipper:

# use_flipper!({ ...

in your Podfile and reinstall Pods

@umang-simform
Copy link
Author

Not sure how other people are not facing this issue, Most probably because they are not using hermes or flipper !!

@mikehardy
Copy link
Contributor

@umang-simform no issues here. I use Flipper and Hermes. I use Intel macs and M1 macs. This works for me compiling it in all sorts of ways https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh as does https://github.com/mikehardy/rnfbdemo/blob/master/notifee-demo.sh

Maybe you have some unsupported configuration of flipper modules. Please don't tag me again, I have nothing to add.

@umang-simform
Copy link
Author

@umang-simform no issues here. I use Flipper and Hermes. I use Intel macs and M1 macs. This works for me compiling it in all sorts of ways https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh as does https://github.com/mikehardy/rnfbdemo/blob/master/notifee-demo.sh

Maybe you have some unsupported configuration of flipper modules. Please don't tag me again, I have nothing to add.

Sorry to tag you directly, obviously not gonna happen again, Only reason I tagged you was that I have used scripts made by you earlier, I will explore more on my side

@umang-simform
Copy link
Author

Closing this issue as it seems an issue with file paths in the Xcode project file. Need to make those changes manually in order to get rid of this error.

@samih7
Copy link

samih7 commented Oct 12, 2021

@umang-simform Could you elaborate?

@escobar5
Copy link

@umang-simform yes, multiple people have this problem, if you could give us more detail it would be very helpful

@umang-simform
Copy link
Author

@escobar5 @samih7 The way I solved the issue is by modifying project.pbxproj file. You can find detailed info here: https://stackoverflow.com/a/69555877/7440820

@aliraza-noon
Copy link

@umang-simform enabling dead code deletions would cause debugging issues IMO

@Shywim
Copy link
Contributor

Shywim commented Oct 15, 2021

We ended up recreating the ios project using a fresh react-native init, then readded everything to the iOS project (we also wrote a script like the one linked previously to automate this in case we need it: #32333 (comment)) and it is set as YES by default:
image

I confirm this is also not present in the pbxproj file anymore.

This is a change that occured in RN 0.62.0, this commit in particular : e3218a0#diff-5e5f05dcdf7a14aea292c3172649e6a220923662fdb41d409997c37da721d27eL505, so I'm not sure it would cause debugging issues if this was a change related to Flipper. Even if I find it weird to activate this setting in a debug configuration, but whatever. XCode and pbxproj are a mess.

Switching it to NO on a new project bring back the problem with 9 duplicate symbols for architecture x86_64. Just wanted to provide context as to why only some people encoutered this issue, and why it works on a new project.

@mikehardy
Copy link
Contributor

Mystery solved! Great analysis

@samih7
Copy link

samih7 commented Oct 15, 2021

Removing DEAD_CODE_STRIPPING = NO; makes the app crash in debug for me.

@umang-simform
Copy link
Author

@umang-simform enabling dead code deletions would cause debugging issues IMO

Yes, I forgot to mention that one, But the main thing is we need to analyse the pbxproj file from fresh project.

@jean-marc-cp
Copy link

@umang-simform enabling dead code deletions would cause debugging issues IMO

Yes, I forgot to mention that one, But the main thing is we need to analyse the pbxproj file from fresh project.

I also ended up updated to Xcode 13 to get this working on my machine.

@umang-simform
Copy link
Author

I am already using xcode 13, Liking it so far :)

@alexfoxy
Copy link

We ended up recreating the ios project using a fresh react-native init, then readded everything to the iOS project (we also wrote a script like the one linked previously to automate this in case we need it: #32333 (comment)) and it is set as YES by default: image

I confirm this is also not present in the pbxproj file anymore.

This is a change that occured in RN 0.62.0, this commit in particular : e3218a0#diff-5e5f05dcdf7a14aea292c3172649e6a220923662fdb41d409997c37da721d27eL505, so I'm not sure it would cause debugging issues if this was a change related to Flipper. Even if I find it weird to activate this setting in a debug configuration, but whatever. XCode and pbxproj are a mess.

Switching it to NO on a new project bring back the problem with 9 duplicate symbols for architecture x86_64. Just wanted to provide context as to why only some people encoutered this issue, and why it works on a new project.

You are a legend, thank you!

@hengsok
Copy link

hengsok commented Nov 13, 2021

We ended up recreating the ios project using a fresh react-native init, then readded everything to the iOS project (we also wrote a script like the one linked previously to automate this in case we need it: #32333 (comment)) and it is set as YES by default: image

I confirm this is also not present in the pbxproj file anymore.

This is a change that occured in RN 0.62.0, this commit in particular : e3218a0#diff-5e5f05dcdf7a14aea292c3172649e6a220923662fdb41d409997c37da721d27eL505, so I'm not sure it would cause debugging issues if this was a change related to Flipper. Even if I find it weird to activate this setting in a debug configuration, but whatever. XCode and pbxproj are a mess.

Switching it to NO on a new project bring back the problem with 9 duplicate symbols for architecture x86_64. Just wanted to provide context as to why only some people encoutered this issue, and why it works on a new project.

This is exactly it! Great experiments to find out the reasons behind this weird behaviour that wasted so much of my time to debug it.

@arthurhts
Copy link

arthurhts commented Sep 20, 2022

I am remove DEAD_CODE_STRIPPING = NO, is resolved problem, version 0.69.5

@facebook facebook locked as resolved and limited conversation to collaborators Oct 12, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests