bugsnag / bugsnag-react-native

Error monitoring and reporting tool for native exceptions and JS errors in React Native apps
https://docs.bugsnag.com/platforms/react-native
MIT License
369 stars 121 forks source link

RN62.0: Multiple targets match implicit dependency for linker flag '-lBugsnagReactNative #476

Closed enigmablue closed 4 years ago

enigmablue commented 4 years ago

Description

I'm trying to upgrade my RN from 61.2 to 62.0

Issue

This looks like its causing my error

Multiple targets match implicit dependency for linker flag '-lBugsnagReactNative'. Consider adding an explicit dependency on the intended target to resolve this ambiguity. (in target 'app' from project 'app')

During archiving this is caused

Build system information
error: Multiple commands produce '/Users/runner/Library/Developer/Xcode/DerivedData/soqqle-dwfbawsdshbrmlchzzthidlmmbmv/Build/Intermediates.noindex/ArchiveIntermediates/app/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libBugsnagReactNative.a':
1) Target 'BugsnagReactNative' has a command with output '/Users/runner/Library/Developer/Xcode/DerivedData/app-dwfbawsdshbrmlchzzthidlmmbmv/Build/Intermediates.noindex/ArchiveIntermediates/app/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libBugsnagReactNative.a'
2) Target 'BugsnagReactNative' has a command with output '/Users/runner/Library/Developer/Xcode/DerivedData/app-dwfbawsdshbrmlchzzthidlmmbmv/Build/Intermediates.noindex/ArchiveIntermediates/app/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/libBugsnagReactNative.a'

I have tried to google but dosen't seem like its anywhere clear. Its only happening to bugsnag, and also realm. Anyone has tips?

Environment

Library versions:

├─ bugsnag-react-native@2.23.10
├─ react-native-code-push@6.1.1
└─ react-native@0.62.0

I'm using the new build system

xljones commented 4 years ago

Hey @enigmablue, looks like the Bugsnag library is trying to be linked twice. Can you please share your Podfile for us to take a look?

There are also a large variety of different reasons this error can be seen, a lot of the solutions are discussed in this Stack Overflow thread: https://stackoverflow.com/questions/50718018/xcode-10-error-multiple-commands-produce do any of these solutions fix your issue?

Additionally, it may be worth cleaning out your React Native project, there are tools like https://www.npmjs.com/package/react-native-clean-project which can help with this, to ensure there are no multiple installations of these libraries.

enigmablue commented 4 years ago

Hi!

My podfile is just like this. Its only happening if i use the new build system. When i revert to the legacy it works fine. But i dont know the main differences between legacy vs new build system. (i have seen that thread and i have gone through them before).

I heard about the clean project today too. I'd give that a shot.


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

target 'xx' do
  pod 'react-native-ffmpeg/min-gpl-lts', :podspec => '../node_modules/react-native-ffmpeg/react-native-ffmpeg.podspec'

  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"

  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  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-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  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 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  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'

  pod 'Bolts'
  use_native_modules!

end
xljones commented 4 years ago

Thanks @enigmablue, we suspect it's a problem that can be solved by cleaning your build environment. In addition to the clean tool above, you may want to use XCode to clean out your ios dir:

$ cd ios
$ xcodebuild clean
enigmablue commented 4 years ago

Thanks @enigmablue, we suspect it's a problem that can be solved by cleaning your build environment. In addition to the clean tool above, you may want to use XCode to clean out your ios dir:

thanks man i tried both the xcode clean and cleanproject but it didn't really help. but eventually i found the error. I had a duplicate xcodeproj in my libraries on the project folder. Deleted them and it worked. I found out because i did a fresh project init and compared the settings one by one.

My previous dev created them when we upgraded to RN60, and i dont think he knew what he was doing. image