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.65k stars 2.21k forks source link

🔥 [🐛] React Native firebase build fails with use_frameworks - normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-cxxreact' from project 'Pods') #8032

Open PrimulaX opened 17 hours ago

PrimulaX commented 17 hours ago

Issue

I'm trying to build the app with use_frameworks enabled in Podfile on iOS but I'm getting this error everytime: ../node_modules/react-native/ReactCommon/cxxreact/Instance.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-cxxreact' from project 'Pods')


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "app", "version": "0.0.0", "license": "MIT", "scripts": { "start": "nx serve", "build": "nx build", "test": "nx test" }, "private": true, "devDependencies": { "@babel/preset-react": "^7.14.5", "@craco/craco": "^5.9.0", "@next/eslint-plugin-next": "^11.1.2", "@nx-tools/container-metadata": "^5.1.0", "@nx-tools/nx-container": "^5.1.0", "@nx/cypress": "19.7.3", "@nx/detox": "19.7.3", "@nx/eslint": "19.7.3", "@nx/eslint-plugin": "19.7.3", "@nx/jest": "19.7.3", "@nx/js": "19.7.3", "@nx/next": "19.7.3", "@nx/react": "19.7.3", "@nx/react-native": "19.7.3", "@nx/web": "19.7.3", "@nx/workspace": "19.7.3", "@react-native-async-storage/async-storage": "^2.0.0", "@react-native-community/cli": "^13.6.4", "@react-native-community/cli-platform-android": "^13.6.9", "@react-native-community/cli-platform-ios": "^13.6.4", "@react-native/babel-preset": "^0.74.83", "@react-native/eslint-config": "^0.74.83", "@react-native/metro-config": "^0.74.87", "@react-native/typescript-config": "^0.74.83", "@svgr/webpack": "^8.1.0", "@swc-node/register": "1.9.2", "@swc/cli": "~0.3.12", "@swc/core": "~1.5.7", "@testing-library/jest-dom": "6.4.8", "@testing-library/jest-native": "5.4.3", "@testing-library/react": "15.0.6", "@testing-library/react-native": "12.5.3", "@types/googlemaps": "^3.43.3", "@types/jest": "29.5.13", "@types/lodash": "^4.14.178", "@types/node": "18.19.50", "@types/react": "18.3.1", "@types/react-dom": "18.3.0", "@types/react-gtm-module": "^2.0.1", "@types/react-is": "18.3.0", "@types/react-redux": "^7.1.16", "@types/react-router-dom": "5.3.3", "@types/styled-components": "^5.1.26", "@typescript-eslint/eslint-plugin": "7.18.0", "@typescript-eslint/parser": "7.18.0", "babel-jest": "29.7.0", "babel-plugin-styled-components": "1.10.7", "detox": "20.18.5", "eslint": "8.57.0", "eslint-config-airbnb-base": "^14.2.1", "eslint-config-airbnb-typescript": "^12.3.1", "eslint-config-next": "14.2.3", "eslint-config-prettier": "9.1.0", "eslint-plugin-cypress": "2.15.1", "eslint-plugin-import": "2.27.5", "eslint-plugin-jsx-a11y": "6.7.1", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "7.32.2", "eslint-plugin-react-hooks": "4.6.0", "jest": "29.7.0", "jest-circus": "28.1.1", "jest-environment-jsdom": "29.7.0", "jest-jasmine2": "29.7.0", "jest-react-native": "18.0.0", "nx": "19.7.3", "prettier": "^2.8.8", "react-dev-utils": "^12.0.1", "react-native-clean-project": "^4.0.3", "react-native-config": "^1.5.0", "react-native-svg": "^15.4.0", "react-native-svg-transformer": "1.3.0", "react-test-renderer": "18.2.0", "sass": "^1.63.6", "ts-jest": "29.1.0", "ts-node": "10.9.1", "typescript": "5.5.4" }, "dependencies": { "@babel/core": "^7.20.12", "@babel/plugin-transform-react-jsx": "^7.20.13", "@babel/polyfill": "^7.12.1", "@babel/runtime": "7.24.5", "@gorhom/portal": "^1.0.14", "@invertase/react-native-apple-authentication": "^2.2.2", "@next/bundle-analyzer": "^12.0.3", "@react-google-maps/api": "^2.12.0", "@react-google-maps/marker-clusterer": "^2.11.8", "@react-native-clipboard/clipboard": "^1.14.0", "@react-native-community/blur": "^4.3.0", "@react-native-community/checkbox": "^0.5.15", "@react-native-community/netinfo": "^11.3.1", "@react-native-cookies/cookies": "^6.2.1", "@react-native-firebase/analytics": "^18.3.0", "@react-native-firebase/app": "^18.3.0", "@react-native-firebase/messaging": "^18.3.0", "@react-native-google-signin/google-signin": "^9.0.2", "@react-native-masked-view/masked-view": "^0.3.0", "@react-navigation/native": "^6.1.3", "@react-navigation/native-stack": "^6.9.9", "@react-navigation/stack": "^6.3.21", "@reduxjs/toolkit": "1.9.0", "@splidejs/react-splide": "^0.7.12", "@swc/helpers": "~0.5.11", "@tanstack/query-sync-storage-persister": "^4.26.1", "@tanstack/react-query": "^4.26.1", "@tanstack/react-query-persist-client": "^4.26.1", "@testing-library/react-hooks": "^8.0.1", "appcenter": "^5.0.1", "appcenter-analytics": "^5.0.1", "appcenter-crashes": "^5.0.1", "axios": "^0.27.2", "core-js": "^3.6.5", "date-fns": "^2.29.3", "dotenv": "^9.0.1", "env-cmd": "^10.1.0", "geolib": "^3.3.3", "i18next": "^21.9.1", "install": "^0.13.0", "jwt-decode": "^3.1.2", "jwt-encode": "^1.0.1", "loading-attribute-polyfill": "^2.1.0", "lodash": "^4.17.21", "lottie-react-native": "^7.0.0", "moment": "^2.29.1", "next": "14.2.3", "next-compose-plugins": "^2.2.1", "next-i18next": "^11.3.0", "next-intl": "^3.5.3", "next-redux-wrapper": "^7.0.5", "next-sitemap": "^1.6.203", "npm": "^8.15.0", "nprogress": "^0.2.0", "nuqs": "^1.17.4", "nx-cloud": "19.1.0", "onesignal": "^0.1.2", "path-browserify": "^1.0.1", "query-string": "^7.1.1", "react": "18.3.1", "react-cool-onclickoutside": "^1.6.2", "react-dom": "18.3.1", "react-facebook-login": "^4.1.1", "react-google-login": "^5.2.2", "react-google-maps": "^9.4.5", "react-gtm-module": "^2.0.11", "react-hook-form": "^7.45.4", "react-i18next": "^11.18.4", "react-is": "18.3.1", "react-native": "0.74.1", "react-native-cloudipsp": "^1.0.0", "react-native-code-push": "^8.0.1", "react-native-color-matrix-image-filters": "^6.0.7", "react-native-device-info": "^10.6.0", "react-native-dotenv": "^3.3.1", "react-native-email-link": "^1.14.5", "react-native-error-boundary": "^1.2.1", "react-native-fast-image": "^8.6.1", "react-native-fbsdk-next": "^11.2.1", "react-native-flash-message": "^0.3.1", "react-native-fs": "^2.20.0", "react-native-geolocation-service": "^5.3.1", "react-native-gesture-handler": "^2.18.1", "react-native-get-random-values": "^1.8.0", "react-native-google-places-autocomplete": "^2.4.1", "react-native-html-to-pdf": "^0.12.0", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-linear-gradient": "^2.6.2", "react-native-maps": "1.13.2", "react-native-notifier": "^1.9.0", "react-native-onesignal": "^5.0.5", "react-native-permissions": "^4.1.5", "react-native-print": "^0.11.0", "react-native-reanimated": "^3.9.0", "react-native-reanimated-carousel": "^3.5.1", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "^4.10.5", "react-native-screens": "^3.31.0", "react-native-share": "^8.2.1", "react-native-skeleton-placeholder": "^5.2.3", "react-native-slider": "^0.11.0", "react-native-sound": "^0.11.2", "react-native-splash-screen": "^3.3.0", "react-native-swipe-gestures": "^1.0.5", "react-native-swiper": "^1.6.0", "react-native-tracking-transparency": "^0.1.2", "react-native-url-polyfill": "^1.3.0", "react-native-uuid": "^2.0.1", "react-native-version-check": "^3.4.3", "react-native-webview": "^13.10.5", "react-native-zohosalesiq-mobilisten": "^9.3.2", "react-navigation": "^4.4.4", "react-query": "^4.0.0", "react-redux": "8.0.5", "react-responsive-carousel": "^3.2.23", "react-router-dom": "6.11.2", "react-scripts": "^5.0.1", "react-slick": "^0.29.0", "redux": "^4.0.5", "redux-persist": "^6.0.0", "redux-thunk": "^2.3.0", "regenerator-runtime": "0.13.7", "sharp": "^0.33.2", "slick-carousel": "^1.8.1", "styled-components": "5.3.6", "swiper": "^11.0.4", "tslib": "^2.3.0", "url-parse": "^1.5.10", "use-places-autocomplete": "^1.9.3", "use-sync-external-store": "^1.2.0", "uuid": "^8.3.2", "webpack": "^5.41.0", "yup": "^1.3.2", "zod": "^3.19.0", "zustand": "^4.3.6" }, "resolutions": { "@types/react": "17.0.3" }, "volta": { "node": "20.5.1", "yarn": "1.22.19" }, "engines": { "node": ">=18" }, "packageManager": "yarn@3.6.4" } ``` #### `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 # Resolve react_native_pods.rb with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )', __dir__]).strip platform :ios, min_ios_version_supported prepare_react_native_project! linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end target 'App' do rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path pod 'RNZohoSalesIQ', :path => '../node_modules/react-native-zohosalesiq-mobilisten/ios' pod 'CodePush', :path => '../node_modules/react-native-code-push' config = use_native_modules! use_frameworks! :linkage => :static $RNFirebaseAsStaticFramework = true use_react_native!( :path => config[:reactNativePath], # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'AppTests' do inherit! :complete # Pods for testing end post_install do |installer| # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false, # :ccache_enabled => true ) installer.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = min_ios_version_supported end end end target 'OneSignalNotificationServiceExtension' do use_frameworks! :linkage => :static pod 'OneSignalXCFramework', '>= 5.0.0', '< 6.0' end def node_require(script) # Resolve script with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', "require.resolve( '#{script}', {paths: [process.argv[1]]}, )", __dir__]).strip end node_require('react-native/scripts/react_native_pods.rb') node_require('react-native-permissions/scripts/setup.rb') # Uncomment wanted permissions setup_permissions([ # 'AppTrackingTransparency', # 'Bluetooth', # 'Calendars', # 'CalendarsWriteOnly', # 'Camera', # 'Contacts', # 'FaceID', 'LocationAccuracy', 'LocationAlways', 'LocationWhenInUse', # 'MediaLibrary', # 'Microphone', # 'Motion', # 'Notifications', # 'PhotoLibrary', # 'PhotoLibraryAddOnly', # 'Reminders', # 'Siri', # 'SpeechRecognition', # 'StoreKit', ]) ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import #import #import #import #import #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.moduleName = @"App"; self.window.backgroundColor = [UIColor colorWithRed:0.70588 green:0.85098 blue:0.51765 alpha:1.00000]; // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{}; NSMutableArray *newArguments = [NSMutableArray arrayWithArray:[[NSProcessInfo processInfo] arguments]]; [newArguments addObject:@"-FIRDebugEnabled"]; [[NSProcessInfo processInfo] setValue:[newArguments copy] forKey:@"arguments"]; [FIRApp configure]; [FBSDKApplicationDelegate.sharedInstance initializeSDK]; [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; [AppCenterReactNative register]; [AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true]; [AppCenterReactNativeCrashes registerWithAutomaticProcessing]; [GMSServices provideAPIKey:@"JKnakljskjldKJLAKLKLkssdsdAASDKLKWww"]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { return [self bundleURL]; } - (NSURL *)bundleURL { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"src/main"]; #else return [CodePush bundleURL]; #endif } - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { NSString* stringURL = [url absoluteString]; if (([stringURL hasPrefix:@"app://"] == YES) && ([RCTLinkingManager application:app openURL:url sourceApplication:nil annotation:nil] == YES)) { return YES; } if ([[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options]) { return YES; } return NO; } - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray> * _Nullable))restorationHandler { return [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler]; } @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:** ``` System: OS: macOS 15.0 CPU: (8) arm64 Apple M1 Memory: 112.02 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.17.0 path: /opt/homebrew/bin/node Yarn: version: 3.6.4 path: /opt/homebrew/bin/yarn npm: version: 8.19.4 path: ~/Desktop/App/app-nx/node_modules/.bin/npm Watchman: version: 2024.09.09.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.15.2 path: /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: - DriverKit 24.0 - iOS 18.0 - macOS 15.0 - tvOS 18.0 - visionOS 2.0 - watchOS 11.0 Android SDK: Not Found IDEs: Android Studio: 2023.3 AI-233.14808.21.2331.11842104 Xcode: version: 16.0/16A242d path: /usr/bin/xcodebuild Languages: Java: version: 17.0.12 path: /usr/bin/javac Ruby: version: 2.6.10 path: /usr/bin/ruby npmPackages: "@react-native-community/cli": installed: 13.6.9 wanted: ^13.6.4 react: installed: 18.3.1 wanted: 18.3.1 react-native: installed: 0.74.1 wanted: 0.74.1 react-native-macos: Not Found npmGlobalPackages: "*react-native*": Not Found Android: hermesEnabled: Not found newArchEnabled: Not found iOS: hermesEnabled: true newArchEnabled: false ``` - **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:** - `^18.3.0` - **`Firebase` module(s) you're using that has the issue:** - `_` - **Are you using `TypeScript`?** - `Y` & `5.5.4`


mikehardy commented 17 hours ago

Hi there 👋

This is not actually an error:

../node_modules/react-native/ReactCommon/cxxreact/Instance.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-cxxreact' from project 'Pods')

There is no error described there nor any details to go on

I can tell you that my build demonstrator that starts from npx react-native init and does every integration step for react-native-firebase results in a functioning build - stated differently, I do not reproduce any build errors with react-native + react-native-firebase

https://github.com/mikehardy/rnfbdemo/blob/main/make-demo.sh

This is likely some local problem and you should start with a much smaller sample project that is just react-native + react-native-firebase to show that it works, then try your full module stack one at a time perhaps

PrimulaX commented 17 hours ago

Hey @mikehardy, thanks for the answer. Yep, seems like it, but I couldn't wrap my head around it, what could be the problem? I'll try with a sample project. By the way, this is what Xcode shows as an error:

image
mikehardy commented 17 hours ago

So, you have an error in the actual react-native compile it appears (react/debug/react_native_assert.h). It does not appear that you have a problem in the react-native-firebase code compiling

Please note you completely skipped the template which means I actually can't help you, my reply was more of a courtesy just to say "start smaller, check locally" but without details and a reproducer there's no way to know

PrimulaX commented 16 hours ago

@mikehardy Hmm, I think you're right. My concern is that when I use the modular_headers workaround, it works, but when I try to enable use_frameworks, it fails. Sorry about that. Could you please let me know what additional information I can provide to be more clear, and if I missed anything from the template?

mikehardy commented 13 hours ago

Sorry, I'm just not sure - all I know is react-native + react-native-firebase works with use_frameworks You might try adding modules one by one until you find the one that cannot tolerate use_frameworks, then open issues with them to fix their compile under what is a valid cocoapods regime (i.e., use_frameworks) I don't think any amount of information will result in a change to this repository, since firebase-ios-sdk requires use_frameworks, and react-native + react-native-firebase works with it