invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.64k stars 2.21k forks source link

Linker command failed during iOS build #7538

Closed macnietzsche closed 8 months ago

macnietzsche commented 8 months ago

Issue

I am trying to build a React Native project for iOS after I upgraded React Native Firebase from v10 to v17. I solved many errors, but I cannot get rid of this last one:

ld: warning: ignoring duplicate libraries: '-lc++'
ld: building for 'iOS-simulator', but linking in object file (/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics[arm64][2](CLSBinaryImage.o)) built for 'iOS'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'React-RCTActionSheet' from project 'Pods')
/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'Fabric' from project 'Pods')
/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'React-callinvoker' from project 'Pods')
/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 11.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'Firebase' from project 'Pods')
/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'boost-for-react-native' from project 'Pods')
/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'RCTRequired' from project 'Pods')
/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'FBLazyVector' from project 'Pods')
/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'React' from project 'Pods')
/Users/mbvillegas94/repositories/see-saw-labs/backporch/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 12.0 to 17.2.99. (in target 'Crashlytics' from project 'Pods')

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:637201FD-B9E2-4C2E-8797-6DD23CC5440C, OS:17.0, name:iPhone 11 }
{ platform:iOS Simulator, id:637201FD-B9E2-4C2E-8797-6DD23CC5440C, OS:17.0, name:iPhone 11 }
** BUILD FAILED **

The following build commands failed:
        Ld /Users/mbvillegas94/Library/Developer/Xcode/DerivedData/backporch-gklonbvhvuffcrcrsbundznbgjak/Build/Products/Debug-iphonesimulator/Backporch.app/Backporch normal (in target 'backporch' from project 'backporch')
(1 failure)

I should mention that the Android build works just fine; only the iOS one fails.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json "@react-native-firebase/analytics": "17.5.0", "@react-native-firebase/app": "17.5.0", "@react-native-firebase/auth": "17.5.0", "@react-native-firebase/crashlytics": "17.5.0", "@react-native-firebase/dynamic-links": "17.5.0", "@react-native-firebase/firestore": "17.5.0", "@react-native-firebase/messaging": "17.5.0", "@react-native-firebase/perf": "17.5.0", "@react-native-firebase/storage": "17.5.0", "react": "16.13.1", "react-native": "0.63.5", ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby use_frameworks! :linkage => :static require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/react-native/scripts/react_native_pods' # use_modular_headers! platform :ios, '11.0' target 'backporch' do config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) target 'backporchTests' do inherit! :complete # Pods for testing end # Enables Flipper. post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings["ONLY_ACTIVE_ARCH"] = "YES" end end installer.pods_project.targets.each do |target| if (target.name&.eql?('FBReactNativeSpec')) target.build_phases.each do |build_phase| if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs')) target.build_phases.move(build_phase, 0) end end end end end # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. # use_flipper!({ 'Flipper-Folly' => '2.3.0' }) # post_install do |installer| # flipper_post_install(installer) # end end ``` #### `AppDelegate.m`: ```objc /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import "AppDelegate.h" #import #import #import #import // #import @import Firebase; @implementation AppDelegate // - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // [FIRApp configure]; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"backporch" 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]; [FIRApp configure]; [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; return YES; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary *)options { [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options]; 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`: ```groovy // N/A ``` #### `android/app/build.gradle`: ```groovy // N/A ``` #### `android/settings.gradle`: ```groovy // N/A ``` #### `MainApplication.java`: ```java // N/A ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` OUTPUT GOES HERE ``` - **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:** - `17.5.0` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Yes` & `3.7.3`


mikehardy commented 8 months ago

Sorry for the very delayed response - just getting back to the issues and PR list here after holidays

"react-native": "0.63.5",

That is simply not going to work. Note that react-native releases are only supported for two versions, I don't think they'll compile well with Xcode 15 until you get to react-native 0.71 in other words

In general, be completely up to date before opening an issue and that includes with react-native

I'm certain there was a fix for the c++ linker symbol thing in recent react-native and I think the update will fix it

Can reopen if reproduces on current versions