React-native: Duplicate symbols after upgrading react-native

Created on 23 Feb 2019  路  19Comments  路  Source: facebook/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

Bug iOS Locked

Most helpful comment

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

All 19 comments

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

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

I was trying to fix this for a few days but today I just gave up and removed iOS folder then re built it with tons of settings I had to configure but in the end it鈥檚 running 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.

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

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

@noway This actually fix my issue, thanks! But also gave me the error library not found for -lDoubleConversion All this happened after a react-native update

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

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

@defghy That shit worked, have a rocket!

rm -rf Podfile.lock
pod deintegrate
pod install

works for me.

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

@defghy Removing the linked binary causes the application not to build when developing, only when archiving, but the funny thing is I have Pods installed, so I don't understand why it's requiring the Linked Binary when building for development, also even if it archives when I remove the linked binaries I think it will only crash, when a user installs it. Will be going to 3 weeks now and I've been exactly here, done with my clients app but can't upload to the AppStore, I honestly am starting to look at using Flutter, RN has given me way too many problems developing, now I just feel stupid convincing my friends to learn RN instead of Flutter. Most things aren't explained and prior knowledge of how iOS or Android development works is just assumed when in reality most of the people who choose to use React Native are web devs who want to enter the mobile dev world, but I digress.

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

Do you mean to delete them from the Libraries folder or remove them from Link Binary in Build Phases?

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?

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.

@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

@defghy Thanks. Worked like a charm.

do not use pod install. instead, In Libraries folder drag .xcodeproj of the library from node modules. This helped me and it always works.

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 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!

Was this page helpful?
0 / 5 - 0 ratings