Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

After updating my app to react-native v0.66.0, I keep getting this error if hermes is enabled. I tried to delete DerivedData folder, podfile podfile.lock... but nothing helped

terminal output

duplicate symbol 'folly::exception_wrapper::from_exception_ptr(std::exception_ptr&&)' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/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/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::onNoExceptionError(char const*)' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exceptionStr(folly::exception_wrapper const&)' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::uninit_' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::ExceptionPtr::ops_' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::SharedPtr::ops_' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ios/podfile

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

target 'MyApp' do
  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
  )

  # Pods for MyApp
  pod 'Firebase/Analytics'
  pod 'AFNetworking', '~> 4.0', :source => 'https://github.com/ElfSundae/CocoaPods-Specs.git'

  use_flipper!()
  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    installer.aggregate_targets.each do |aggregate_target| 
      aggregate_target.user_project.native_targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
        end
      end
      aggregate_target.user_project.save
    end

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
       end
    end
    `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h`
  end
end

I want to use flipper to debug my app and hermes is enabled, thank all.

Edit: I can build the project from Xcode

like image 446
cuongtd Avatar asked Oct 04 '21 04:10

cuongtd


1 Answers

I can run project successfully now by removing

DEAD_CODE_STRIPPING = NO;

in project.pbxproj

or go to Build Settings tab in Xcode then enable Dead Code Stripping for Debug mode

enter image description here

like image 188
cuongtd Avatar answered Oct 24 '22 01:10

cuongtd