React-native-firebase: 2 duplicate symbols for architecture x86_64

Created on 31 Jan 2020  路  23Comments  路  Source: invertase/react-native-firebase


Issue



I am unable to build react-native project on Mac OS Catilina. I am getting error "2 duplicate symbols for architecture x86_64". It was working fine on Mac OS High Sierra but after upgrading to OS Catalina, I am getting following errors.

duplicate symbol _OBJC_CLASS_$_FIRIAMDefaultDisplayImpl in:
/Users/apple/Library/Developer/Xcode/DerivedData/{product name}/Build/Products/Debug-iphonesimulator/FirebaseInAppMessaging/libFirebaseInAppMessaging.a(FIRIAMDefaultDisplayImpl.o)
/Users/apple/Library/Developer/Xcode/DerivedData/{product name}/Build/Products/Debug-iphonesimulator/FirebaseInAppMessagingDisplay/libFirebaseInAppMessagingDisplay.a(FIRIAMDefaultDisplayImpl.o)
duplicate symbol _OBJC_METACLASS_$_FIRIAMDefaultDisplayImpl in:
/Users/apple/Library/Developer/Xcode/DerivedData/{product name}/Build/Products/Debug-iphonesimulator/FirebaseInAppMessaging/libFirebaseInAppMessaging.a(FIRIAMDefaultDisplayImpl.o)
/Users/apple/Library/Developer/Xcode/DerivedData/{product name}/Build/Products/Debug-iphonesimulator/FirebaseInAppMessagingDisplay/libFirebaseInAppMessagingDisplay.a(FIRIAMDefaultDisplayImpl.o)
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Project Files






Javascript

Click To Expand

#### `package.json`:

"scripts": {
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/netinfo": "4.1.5",
    "@react-native-firebase/app": "6.2.0",
    "@react-native-firebase/messaging": "6.2.0",
    "@react-native-firebase/crashlytics": "6.2.0",
    "@react-native-firebase/in-app-messaging": "6.2.0",
    "@react-native-firebase/analytics": "6.2.0",
    "@redux-offline/redux-offline": "2.5.2-native.0",
    "amplitude-js": "4.7.0-react-native",
    "axios": "0.18.0",
    "eslint-config-rallycoding": "3.2.0",
    "immutability-helper": "2.7.0",
    "lodash": "4.17.14",
    "native-base": "2.13.5",
    "react": "16.8.6",
    "react-native": "0.60.5",
    "react-native-appstore-version-checker": "3.0.0",
    "react-native-device-info": "2.3.2",
    "react-native-gesture-handler": "1.4.1",
    "react-native-reanimated": "1.2.0",
    "react-native-render-html": "4.2.0",
    "react-native-responsive": "1.0.2",
    "react-native-screens": "2.0.0-alpha.3",
    "react-native-splash-screen": "3.2.0",
    "react-native-vector-icons": "6.6.0",
    "react-native-webview": "8.0.3",
    "react-navigation": "4.0.5",
    "react-navigation-redux-helpers": "3.0.6",
    "react-navigation-stack": "1.8.0",
    "react-navigation-tabs": "2.5.3",
    "react-redux": "5.0.7",
    "redux": "3.7.2",
    "redux-thunk": "2.2.0"
  },
  "devDependencies": {
    "@babel/core": "7.5.5",
    "@babel/runtime": "7.5.5",
    "@react-native-community/eslint-config": "0.0.3",
    "babel-jest": "24.9.0",
    "eslint": "6.2.1",
    "metro-react-native-babel-preset": "0.54.1",
    "jest": "24.9.0",
    "react-test-renderer": "16.8.6"
  },
  "jest": {
    "preset": "react-native"
  }
#### `firebase.json` for react-native-firebase v6:
# N/A
### iOS
Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like:

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

target '{Project Name}' do

  # Pods for project
  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-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'
  pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'

  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  pod 'Fabric', '~> 1.9.0'

  use_native_modules!
end

#### `AppDelegate.m`:
#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <Firebase.h>
#import "RNSplashScreen.h"


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
  if ([UNUserNotificationCenter class] != nil) {
    // iOS 10 or later
    // For iOS 10 display notification (sent via APNS)
    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
    UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert |
    UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
    [[UNUserNotificationCenter currentNotificationCenter]
     requestAuthorizationWithOptions:authOptions
     completionHandler:^(BOOL granted, NSError * _Nullable error) {
       // ...
     }];
  } else {
    // iOS 10 notifications aren't available; fall back to iOS 8-9 notifications.
    UIUserNotificationType allNotificationTypes =
    (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
    UIUserNotificationSettings *settings =
    [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
    [application registerUserNotificationSettings:settings];
  }

  [application registerForRemoteNotifications];

  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
                                                   moduleName:@"{Project Name}"
                                            initialProperties:nil];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
  [RNSplashScreen show];
  return YES;
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

@end


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:

// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->


Environment

Click To Expand

**`react-native info` output:**

 System:
    OS: macOS 10.15.3
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 7.34 GB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.0 - /usr/local/bin/node
    npm: 6.4.1 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
  IDEs:
    Xcode: 10.1/10B61 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1
- **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `6.2.0` - **`Firebase` module(s) you're using that has the issue:** - `In App Messaging` - **Are you using `TypeScript`?** - `N`




Think react-native-firebase is great? Please consider supporting all of the project maintainers and contributors by donating via our Open Collective where all contributors can submit expenses. [Learn More]

Build Error iOS Stale >= 6

Most helpful comment

Ok as I thought it was a dependency conflict, just downgrading the FirebaseInAppMessaging to 0.16.0 will fix the problem.

@Tayyab100 add this to your Pod file

pod 'FirebaseInAppMessaging', '0.16.0'

All 23 comments

You can imagine about everyone is already using Catalina and it's working fine for everyone else, so this will be something specific to your machine and/or project.

I can only recommend npx react-native-clean-project clean-project-auto && yarn (or npm) && cd ios && pod install then re-trying.

Preliminarily closing but if you can provide a minimal reproducible example (sort of like this https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh - which shows it works) then we can reproduce and fix

Hi @mikehardy , Unfortunately I faced with the same issues today, working fine yesterday but after clean Install I'm getting the same error.

I tried to cleanup everything and try again but nothing is works.

#!/usr/bin/env bash

ROOT=$(pwd)


# remove node_modules
rm -rf node_modules

# clean up ios
cd ios
pod cache clean --all
rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate

cd $ROOT
npm install

cd ios
pod setup
pod install

Maybe a dependency conflict ?

No idea. Your commands look interesting but I wouldn't trust myself to remember everything. I'd run the command I specified.

Yeah I have also deleted derived data, hard cleaned the project and also run npx react-native-clean-project clean-project-auto command. Also I have cleared npm cache, pod cache. But still getting error. I have checked that pod is using version 6.13 firebase Ios sdk. and it is downloading version 0.17.0 for FirebaseInAppMessaging and for FirebaseInAppMessagingDisplay it is downloading 0.15.5 version.

Ok as I thought it was a dependency conflict, just downgrading the FirebaseInAppMessaging to 0.16.0 will fix the problem.

@Tayyab100 add this to your Pod file

pod 'FirebaseInAppMessaging', '0.16.0'

Out of curiosity, why not move forward to pods 6.16.0 ? (or 6.15.0 perhaps, as 6.16.0 specifically changes InAppMessaging items, if you read the firebase ios sdk release notes)

Thankyou @N3TC4T and @mikehardy for the help . Yes, by downgrading firebase in app messaging from 0.17.0 (installing by default) to 0.16.0, it is working fine now.

Hi everyone just experienced the same issue. I need to clean project then close Xcode then add
pod 'FirebaseInAppMessaging', '0.16.0' after that I run pod update then It works as expected. Why this happen ?

Thanks to @N3TC4T for the tips

I think that this issue is related to https://github.com/firebase/firebase-ios-sdk/pull/4899.

Why was this closed? This is still an issue on 6.3.4. Adding pod 'FirebaseInAppMessaging', '0.16.0' to the Podfile solves this, but I don't feel like that's an appropriate longterm solution.

@todesignandconquer I think it's closed because it doesn't appear to be a current issue, I can't reproduce it anyway and my automated throwaway demo app builder uses in app messaging to show it works: https://github.com/mikehardy/rnfbdemo/blob/37360eac1f3861c8ffbc5dd1a0e349d597d81f9f/make-demo-v6.sh#L65

There was one problem with the most up to date upstream firebase ios sdks requiring a simple fix: https://github.com/mikehardy/rnfbdemo/blob/37360eac1f3861c8ffbc5dd1a0e349d597d81f9f/make-demo-v6.sh#L147 - but that's a separate issue and should be released shortly (but can be patch-packaged until release)

@mikehardy Thanks for the quick response!

I definitely have the same issue as presented in this ticket, and I only implement 3 Firebase dependencies:

    "@react-native-firebase/analytics": "^6.3.4",
    "@react-native-firebase/app": "^6.3.4",
    "@react-native-firebase/in-app-messaging": "^6.3.4",

I am not using yarn to maintain my project but on the surface that should not matter, but those are the versions I am running it on.

You should clone that demo script repo and run it - give it a shot. Definitely try react-native-clean-project first and purge everything.

@N3TC4T solution also works for me. I've also created an empty project to test my dependencies and this is my podfile (extracted my manual changes, the rest is just auto generated code by expo):

  pod 'GoogleUtilities', '= 6.5.2'
  pod 'GoogleIDFASupport', '= 3.14.0'
  pod 'Firebase/Core', '~> 6.13.0'
  pod 'Firebase/Messaging', '~> 6.13.0'
  pod 'Firebase/Analytics', '~> 6.13.0'
  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
  pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'
  pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics'
  pod 'RNFBInAppMessaging', :path => '../node_modules/@react-native-firebase/in-app-messaging'

And package.json:

    "@react-native-firebase/analytics": "^6.3.4",
    "@react-native-firebase/app": "^6.3.4",
    "@react-native-firebase/in-app-messaging": "^6.3.4",
    "@react-native-firebase/messaging": "^6.3.4",

it is just an empty project and it doesn't compile because of the "duplicate symbol" error, but when I comment RNFBInAppMessaging from Podfile, it compiles and works.

For more clarity, this is how I created my empty project:
1) create a normal expo project (I chose blank-typescript)
2) eject to expokit (you can try to eject to something else, but this is what I did)
3) add the above dependencies in package.json and Podfile (you may have to manually update the Podfile)

If this is expo related you'll have to take it up with them

For react-native-firebase v6 you don't need to add any modules in podfile. You can see in the podfile built from my sample generator that it contains none of that. Auto-linking handles it for you.

@mikehardy I am running your demo right now, but I already notice the discrepancy:

Installing pods and running iOS app
RNFBAdMob: Using user specified Firebase SDK version '6.18.0'

All of the versions installed thus far are on 6.18.0 as indicated by $FirebaseSDKVersion within your Podfile. The duplicate symbol issue is happening when not specifying the SDK version. It might explain why it cannot be replicated in your demo.

By getting rid of the $FirebaseSDKVersion and bumping the Podfile to use platform :ios, '11.0', I was able to replicate the issue.

The modified Podfile:

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

target 'rnfbdemo' do
  # Pods for rnfbdemo
  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'

  target 'rnfbdemoTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'rnfbdemo-tvOS' do
  # Pods for rnfbdemo-tvOS

  target 'rnfbdemo-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

Why would you choose to use old software? They are on 6.20.0 now.

I don't think anyone is specifically choosing to use old software, but if not specified the default within this library in all of the podspecs is identified as 6.13.0, e.g. https://github.com/invertase/react-native-firebase/blob/master/packages/analytics/RNFBAnalytics.podspec#L4

$FirebaseSDKVersion is mentioned nowhere within the documentation to be something that should be defined, but you have to dig through within this template to even find a reference of it: https://github.com/invertase/react-native-firebase/blob/master/packages/template/project/ios/Podfile#L5

Ah! I see - much different it was a default vs something explicitly chosen. So, this is an incompatibility between bumping platform and the default :thinking: - @Salakar I don't know where the lower bound on this interaction is (@todesignandconquer maybe you could bisect between 6.13 and 6.20 to see when this starts happening?) but the default firebase ios sdk version appears to create build errors in certain cases for published stable RNFBv6

Interesting, I came into a new issue, both in the project I am working on and in the demo project:

After trying to find the bisect to see where this issue is resolved, setting $FirebaseSDKVersion failed using 6.13.0, 6.14.0, or 6.15.0 with the duplicate symbols error.

At $FirebaseSDKVersion = 6.16.0, it gave the following error:

error: use of undeclared identifier 'FIRInAppMessaging'
    constants[@"isMessagesDisplaySuppressed"] = @([RCTConvert BOOL:@([FIRInAppMessaging inAppMessaging].messageDisplaySuppressed)]);
                                                                      ^
error: use of undeclared identifier 'FIRInAppMessaging'
    constants[@"isAutomaticDataCollectionEnabled"] = @([RCTConvert BOOL:@([FIRInAppMessaging inAppMessaging].automaticDataCollectionEnabled)]);
                                                                           ^
error: use of undeclared identifier 'FIRInAppMessaging'
    [FIRInAppMessaging inAppMessaging].automaticDataCollectionEnabled = (BOOL) enabled;
     ^
/error: use of undeclared identifier 'FIRInAppMessaging'
    [FIRInAppMessaging inAppMessaging].messageDisplaySuppressed = (BOOL) enabled;
     ^
4 errors generated.

@todesignandconquer this will get you past your new error so you can use 6.20.0: https://github.com/mikehardy/rnfbdemo/blob/37360eac1f3861c8ffbc5dd1a0e349d597d81f9f/make-demo-v6.sh#L146-L149

(note it's already merged upstream, it will be in the next RNFBv6 release, so you can patch-package it or however you need to do it to integrate it while waiting)

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alizahid picture alizahid  路  3Comments

escobar5 picture escobar5  路  3Comments

joecaraccio picture joecaraccio  路  3Comments

Damnum picture Damnum  路  3Comments

mahyarr picture mahyarr  路  3Comments