react-native: ld: 1319 duplicate symbols for architecture x86_64 after upgrading to 0.60 from 0.59.9

I upgraded the react native version to 0.60 from 0.59.9. I wasn’t using any Pods when on 0.59.9. But after 0.60, I added Podfile with following content (as per rn-diff)

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'taxiApp' do
rn_maps_path = '../node_modules/react-native-maps'
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  
  target 'taxiAppTests' do
    inherit! :search_paths
    # Pods for testing
  end
  use_native_modules!
end 

//this is for solving some issue with react-native-config and cocoapods
post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == 'react-native-config'
        phase = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
        phase.shell_script = "cd ../../"\
                             " && RNC_ROOT=./node_modules/react-native-config/"\
                             " && export SYMROOT=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && export BUILD_DIR=$RNC_ROOT/ios/ReactNativeConfig"\
                             " && ruby $RNC_ROOT/ios/ReactNativeConfig/BuildDotenvConfig.ruby"
  
        target.build_phases << phase
        target.build_phases.move(phase,0)
      end
    end
  end

I did pod install which installed 4 extra pods (maybe as a part of auto linking):

react-native-config (0.11.7)
react-native-geolocation (1.4.2)
react-native-maps (0.24.2)
RNGestureHandler

After that, I opened Xcode and started building the app and I got this issue with duplicate symbols. A lot of pods/libraries are being installed (duplicate). For example:

I think this is a problem Both jsi and React-jsi are being installed while building the project.

React Native version:

System:
    OS: macOS 10.14.5
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 89.96 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 11.9.0 - /usr/local/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.5.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 27.0.3, 28.0.3
      System Images: android-24 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.0 => 0.60.0
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7

Steps To Reproduce

  1. Upgrade to RN-0.60
  2. Have packages which needs installing pods
  3. pod install
  4. Build the project from XCode

Describe what you expected to happen: I expect it to not install duplicate pods/libraries and successful build.

About this issue

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

Commits related to this issue

Most upvoted comments

I actually removed all of these contents inside Link Binary With Libraries and the build was successful. But I don’t understand what’s going on in here.

I think RN shifted to Pods , all native ios stuff is now handled by pods , Therefore you don’t need those Linked Libraries. https://github.com/react-native-community/upgrade-helper/issues/47

I updated from 0.57.8 to 0.60.0 following RN Update Helper and my build still failing 😦

rm -rf Podfile.lock pod deintegrate pod install

Remove if something left in Link Binaries.

@Psiiirus Facing issue with PushNotificationIOS after upgrading to 0.60, can you let us know how RCTPushNotification is listed in pod file.

Below is the error details:

In file included from /…/node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.m:8:

/…/node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h:8:9: fatal error: ‘React/RCTEventEmitter.h’ file not found

#import <React/RCTEventEmitter.h> ^~~~~~~~~~~~~~~~~~~~~~~~~

@martindavid Did u get the fix for the PushNotification?

Just remove everything from Build Phases/ Link Binary With Libraries , and it must work! 🤙🤘

@Psiiirus Facing issue with PushNotificationIOS after upgrading to 0.60, can you let us know how RCTPushNotification is listed in pod file.

Below is the error details:

In file included from /…/node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.m:8:

/…/node_modules/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h:8:9: fatal error: ‘React/RCTEventEmitter.h’ file not found

#import <React/RCTEventEmitter.h> ^~~~~~~~~~~~~~~~~~~~~~~~~

@martindavid Did u get the fix for the PushNotification?

Not 100% whats your problem is, sorry…but one lession i learned…drop the whole node_modules folder and do a clean build 😃

Link Binary and Libraries in Build Phases looks like this.

image