react-native: Duplicate symbols after upgrading react-native

🐛 Bug Report

Today after i upgraded my react-native via react-native-git-upgrade i’m getting duplicated symbols for libFolly.a and libReact.a files.

Edit: it works on android

Error Output

duplicate symbol __ZN5folly7dynamic7destroyEv in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZNK5folly7dynamic4hashEv in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZNK5folly7dynamic4sizeEv in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZNK5folly7dynamic8typeNameEv in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly9TypeErrorD2Ev in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly9TypeErrorD1Ev in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly9TypeErrorD0Ev in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly9TypeErrorC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_7dynamic4TypeESB_ in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly9TypeErrorC1ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_7dynamic4TypeESB_ in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic5eraseENSt3__111__wrap_iterIPKS0_EES5_ in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamicaSEOS0_ in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZNK5folly7dynamicltERKS0_ in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZNK5folly7dynamiceqERKS0_ in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamicaSERKS0_ in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZTVN5folly9TypeErrorE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZTSN5folly9TypeErrorE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZTIN5folly9TypeErrorE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoIxE4typeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoIdE4typeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoIbE4typeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoINS0_10ObjectImplEE4typeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEE4typeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoINSt3__16vectorIS0_NS2_9allocatorIS0_EEEEE4typeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly9TypeErrorC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_7dynamic4TypeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly9TypeErrorC1ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_7dynamic4TypeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8typeNameENS0_4TypeE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoIxE4nameE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoIdE4nameE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoIbE4nameE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoINS0_10ObjectImplEE4nameE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEE4nameE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
duplicate symbol __ZN5folly7dynamic8TypeInfoINSt3__16vectorIS0_NS2_9allocatorIS0_EEEEE4nameE in:
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/Folly/libFolly.a(dynamic.o)
    /Users/myPath/ios/build/Build/Products/Debug-iphonesimulator/libReact.a(dynamic.o)
ld: 32 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To Reproduce

building the app from xcode or by running react-native run-ios

Expected Behavior

able to build and run the app as before upgrading react-native

Code Example

Podfile

target 'AverageSpeedRN' do
    rn_path = '../node_modules/react-native'
    rn_maps_path = '../node_modules/react-native-maps'
  
    pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
    pod 'React', path: rn_path, subspecs: [
      'Core',
      'CxxBridge',
      'DevSupport',
      'RCTActionSheet',
      'RCTAnimation',
      'RCTGeolocation',
      'RCTImage',
      'RCTLinkingIOS',
      'RCTNetwork',
      'RCTSettings',
      'RCTText',
      'RCTVibration',
      'RCTWebSocket',
    ]
  
    pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
    pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
    pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"
  
    pod 'react-native-maps', path: rn_maps_path
    pod 'react-native-google-maps', path: rn_maps_path
    pod 'GoogleMaps' 
    pod 'Google-Maps-iOS-Utils'
    pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

    pod 'react-native-location', :path => '../node_modules/react-native-location'

  end
  
  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'react-native-google-maps'
        target.build_configurations.each do |config|
          config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
        end
      end
      if target.name == "React"
        target.remove_from_project
      end
    end
  end

Environment

React Native Environment Info:
    System:
      OS: macOS 10.14.3
      CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
      Memory: 82.89 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.10.0 - /usr/local/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.8.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 26, 27, 28
        Build Tools: 23.0.3, 24.0.0, 26.0.3, 27.0.3, 28.0.2, 28.0.3
        System Images: android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5199772
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3 
      react-native: 0.58.5 => 0.58.5 
    npmGlobalPackages:
      react-native-git-upgrade: 0.2.7

Linked Frameworks

screen shot 2019-02-23 at 2 53 30 pm

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 19 (3 by maintainers)

Most upvoted comments

For me, delete all Link Binary With Libraries and run pod install fix it;

rm -rf Podfile.lock pod deintegrate pod install

works for me.

@fuzunspm Okay my project is working again I just removed my Pods directory and the Podfile.lock and the run pod install again.

Hello there 👋 by using the repro / the list of steps to reproduce, we can’t actually see the reported bug on RN 0.59.5 so we’ll close this issue. It may have something to do with your local setup, please double check that you are using the correct version of Android Studio / XCode / Android NDK / Yarn / etc.

I upgraded to RN0.60.4, and I had to delete every *.a file in Link Binary with Libraries manually. I then ran pod install so that only libPods-{projectName}.a was on that list and everything is back to building normally! Hope this helps

I’m having the same problem. Upgrading from a custom 0.56.0 build to 0.58.5

had the same issue but @reyalpsirc 's fix worked for me

I upgraded to RN0.60.4, and I had to delete every *.a file in Link Binary with Libraries manually. I then ran pod install so that only libPods-{projectName}.a was on that list and everything is back to building normally! Hope this helps

Thanks it work like charm!

You need to manually fix OTHER_LDFLAGS which is coming from pods config. image

Browse Config file for the pods and remove -L"Folly" from there

@tonynguyenit18 I was able to resolve my issue, here’s the link to the answer on StackOverflow for anyone who tried everything here and it didn’t work. https://stackoverflow.com/a/57450860/1134317

For me, delete all Link Binary With Libraries and run pod install fix it;

@defghy That shit worked, have a rocket!

@steinarsa Did you delete them from the Libraries folder or remove them from Link Binary in Build Phases?

Delete items from Link Binary in Build Phases works for me.

For me, delete all Link Binary With Libraries and run pod install fix it;

@defghy That shit worked, have a rocket!