dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
570 stars 459 forks source link

Build fail on Cordova-ios 7.1.0 - Xcode 1.15.2 #887

Open FranGhe opened 1 month ago

FranGhe commented 1 month ago

I updated my cordova-ios to 7.1.0 and build fail.

mac version macOS Sonoma 14.4.1 (23E224)

xcode version version 15.2

Pod Version 1.15.2

iOS SDKs iOS 17.2 -sdk iphoneos17.2

cordova platform ios 7.1.0

cordova plugin
@ahovakimyan/cordova-plugin-wkwebviewxhrfix 1.0.2 "Cordova WKWebView File XHR Fix" cordova-background-geolocation-plugin 2.0.5 "cordova-background-geolocation-plugin" cordova-clipboard 1.3.0 "Clipboard" cordova-open-native-settings 1.5.5 "Native settings" cordova-plugin-app-version 0.1.14 "AppVersion" cordova-plugin-device 2.1.0 "Device" cordova-plugin-dialogs 2.0.2 "Notification" cordova-plugin-file 8.0.0 "File" cordova-plugin-firebasex 16.5.0 "Google Firebase Plugin" cordova-plugin-geolocation 4.1.0 "Geolocation" cordova-plugin-globalization 1.11.0 "Globalization" cordova-plugin-inappbrowser 6.0.0 "InAppBrowser" cordova-plugin-insomnia 4.3.0 "Insomnia (prevent screen sleep)" cordova-plugin-native-app-update 2.0.0 "AppUpdate" cordova-plugin-network-information 3.0.0 "Network Information" cordova-plugin-statusbar 4.0.0 "StatusBar" cordova-plugin-wkwebview-file-xhr 3.1.1 "Cordova WKWebView File XHR Plugin" cordova-plugin-x-socialsharing 6.0.4 "SocialSharing" cordova.plugins.diagnostic 7.1.4 "Diagnostic" es6-promise-plugin 4.2.2 "Promise"

These are my actions:

  1. cordova plugin add cordova-plugin-firebasex 1.1. cordova buid ... and after 10-15 minutes it fail with error (I attach here the complete building messages logs.txt.zip):

    The following build commands failed: .../myapp/platforms/ios/build/Debug-iphonesimulator/gRPC-Core/grpc.framework/grpc normal (in target 'gRPC-Core' from project 'Pods') Command failed with exit code 65: xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator -destination platform=iOS Simulator,name=iPhone 15 Pro Max build SYMROOT=/Users/MyName/projects/myapp/platforms/ios/build

  2. cordova plugin remove cordova-plugin-firebasex 2.1. cordova plugin add cordova-plugin-firebasex --variable IOS_USE_PRECOMPILED_FIRESTORE_POD=true 2.2. cordova buid ... and after 5minutes build succeeded... but 2.3. I open xcode to install my project to my Ipad, it starts to build and... it fails with errors on compiling firebase::firestore with errors:

    ld: Undefined symbols: absl::lts_20240116::numbers_internal::FastIntToBuffer(int, char), referenced from: absl::lts_20240116::AlphaNum::AlphaNum(int) in FirebaseFirestoreInternal [68] (FIRDocumentChange.o) absl::lts_20240116::numbers_internal::FastIntToBuffer(long long, char), referenced from: absl::lts_20240116::AlphaNum::AlphaNum(long long) in FirebaseFirestoreInternal [86] (FIRFirestoreSettings.o) absl::lts_20240116::numbers_internal::FastIntToBuffer(unsigned long long, char), referenced from: absl::lts_20240116::AlphaNum::AlphaNum(unsigned long) in FirebaseFirestoreInternal [41] (document_key.o) absl::lts_20240116::AlphaNum::AlphaNum(unsigned long long) in FirebaseFirestoreInternal [103] (FSTUserDataReader.o) absl::lts_20240116::numbers_internal::SixDigitsToBuffer(double, char), referenced from: absl::lts_20240116::AlphaNum::AlphaNum(double) in FirebaseFirestoreInternal [89] (FIRGeoPoint.o) absl::lts_20240116::optional_internal::throw_bad_optional_access(), referenced from: -[FIRDocumentSnapshot initWithFirestore:documentKey:document:metadata:] in FirebaseFirestoreInternal [70] (FIRDocumentSnapshot.o) std::1::function::func<firebase::firestore::core::FirestoreClient::GetDocumentsFromLocalCache(firebase::firestore::api::Query const&, std::1::unique_ptr<firebase::firestore::core::EventListener, std::1::default_delete<firebase::firestore::core::EventListener>>&&)::$_16, std::1::allocator<firebase::firestore::core::FirestoreClient::GetDocumentsFromLocalCache(firebase::firestore::api::Query const&, std::1::unique_ptr<firebase::firestore::core::EventListener, std::__1::default_delete<firebase::firestore::core::EventListener>>&&)::$_16>, void ()>::operator()() in FirebaseFirestoreInternal [79] (firestore_client.o) std::1::function::func<firebase::firestore::core::FirestoreClient::GetNamedQuery(std::1::basic_string<char, std::__1::char_traits, std::1::allocator> const&, std::1::function<void (firebase::firestore::core::Query, bool)>)::$_27, std::1::allocator<firebase::firestore::core::FirestoreClient::GetNamedQuery(std::1::basic_string<char, std::1::char_traits, std::1::allocator> const&, std::1::function<void (firebase::firestore::core::Query, bool)>)::$_27>, void ()>::operator()() in FirebaseFirestoreInternal [79] (firestore_client.o) std::1::function::func<std::1::enable_if<!std::is_same<void, decltype(fp0())>::value, decltype(fp0())>::type firebase::firestore::local::Persistence::Run<firebase::firestore::local::LocalStore::RejectBatch(int)::$_6>(absl::lts_20240116::string_view, firebase::firestore::local::LocalStore::RejectBatch(int)::$_6)::'lambda'(), std::1::allocator<std::1::enable_if<!std::is_same<void, decltype(fp0())>::value, decltype(fp0())>::type firebase::firestore::local::Persistence::Run<firebase::firestore::local::LocalStore::RejectBatch(int)::$_6>(absl::lts_20240116::string_view, firebase::firestore::local::LocalStore::RejectBatch(int)::$_6)::'lambda'()>, void ()>::operator()() in FirebaseFirestoreInternal [143] (local_store.o) firebase::firestore::local::QueryEngine::GetDocumentsMatchingQuery(firebase::firestore::core::Query const&, firebase::firestore::model::SnapshotVersion const&, firebase::firestore::immutable::SortedSet<firebase::firestore::model::DocumentKey, firebase::firestore::util::Comparator> const&) const in FirebaseFirestoreInternal [181] (query_engine.o) firebase::firestore::local::QueryEngine::PerformQueryUsingIndex(firebase::firestore::core::Query const&) const in FirebaseFirestoreInternal [181] (query_engine.o) absl::lts_20240116::StrCat(absl::lts_20240116::AlphaNum const&, absl::lts_20240116::AlphaNum const&, absl::lts_20240116::AlphaNum const&), referenced from: firebase::firestore::core::Query::ToString() const in FirebaseFirestoreInternal [178] (query.o) firebase::firestore::core::Query::CanonicalId() const in FirebaseFirestoreInternal [178] (query.o) absl::lts_20240116::StrAppend(std::1::basic_string<char, std::__1::char_traits, std::1::allocator>*, absl::lts_20240116::AlphaNum const&, absl::lts_20240116::AlphaNum const&), referenced from: -[FSTFirestoreComponent firestoreForDatabase:] in FirebaseFirestoreInternal [102] (FSTFirestoreComponent.o) absl::lts_20240116::string_view::find(absl::lts_20240116::string_view, unsigned long) const, referenced from: -[FIRQuery boundFromFieldValues:isInclusive:] in FirebaseFirestoreInternal [94] (FIRQuery.o) clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is my Podfile on Xcode:

source 'https://cdn.cocoapods.org/' platform :ios, '12.0' use_frameworks! target 'Cortona' do project 'Cortona.xcodeproj' pod 'FirebaseCore', '10.24.0' pod 'FirebaseAuth', '10.24.0' pod 'FirebaseAnalytics', '10.24.0' pod 'FirebaseMessaging', '10.24.0' pod 'FirebasePerformance', '10.24.0' pod 'FirebaseRemoteConfig', '10.24.0' pod 'FirebaseInAppMessaging', '10.24.0-beta' pod 'FirebaseFirestore', :tag => '10.24.0', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git' pod 'FirebaseCrashlytics', '10.24.0' pod 'FirebaseFunctions', '10.24.0' pod 'FirebaseInstallations', '10.24.0' pod 'GoogleSignIn', '6.2.4' pod 'GoogleTagManager', '7.4.6' end

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf-with-dsym' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle" config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO' end end end end

I have seen that last version of pre-compiled version of the Firestore pod is 10.25.0... I tried to edit the FirebaseFirestore version on my Xcode Podfile and launch again the build, but it fails with the same issues.

Have to do something before the cordova build? @dpa99c ... Can you explain me how and where? I read and read again posts and guideline but I have no understand how I can fix my troubles.

It's frustrating, I'm breaking my head on wall corner since few days because my app is working on Android but I can't bulid it on my Ipad

Thanks

calvinchu8172 commented 1 month ago

I have same gRPC-Core error while building, too.

mac version macOS Sonoma 14.4.1

xcode version version 15.4

Pod Version 1.15.2

iOS SDKs iOS 17.4 -sdk iphoneos17.4

cordova platform ios 6.3.0

cordova-plugin-firebasex 16.4.0

ionic info

Ionic:

   Ionic CLI                     : 6.19.1 (/Users/calvinchu/.nvm/versions/node/v14.19.3/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 6.2.7
   @angular-devkit/build-angular : 13.2.6
   @angular-devkit/schematics    : 13.3.9
   @angular/cli                  : 13.2.6
   @ionic/angular-toolkit        : 6.1.0

Cordova:

   Cordova CLI       : 11.0.0
   Cordova Platforms : ios 6.3.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 27 other plugins)

Utility:

   cordova-res                          : 0.15.4
   native-run (update available: 2.0.1) : 1.7.0

System:

   Android SDK Tools : 26.1.1 (/Users/calvinchu/Library/Android/sdk)
   ios-deploy        : 1.12.2
   ios-sim           : 8.0.2
   NodeJS            : v14.19.3 (/Users/calvinchu/.nvm/versions/node/v14.19.3/bin/node)
   npm               : 6.14.17
   OS                : macOS
   Xcode             : Xcode 15.4 Build version 15F31d

Error log

I ran ionic cordova build ios --prod --debug --verbose

** BUILD FAILED **

The following build commands failed:
    Ld /Users/work_folder/my_ionic6_project/platforms/ios/build/emulator/grpc.framework/grpc normal (in target 'gRPC-Core' from project 'Pods')
(1 failure)
Command finished with error code 65: xcodebuild -workspace,Exohome.xcworkspace,-scheme,Exohome,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone 15 Pro Max,build,CONFIGURATION_BUILD_DIR=/Users/work_folder/my_ionic6_project/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/work_folder/my_ionic6_project/platforms/ios/build/sharedpch
xcodebuild: Command failed with exit code 65
Error: xcodebuild: Command failed with exit code 65
    at ChildProcess.whenDone (/Users/work_folder/my_ionic6_project/node_modules/cordova-common/src/superspawn.js:136:25)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1088:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
[ERROR] An error occurred while running subprocess cordova.
globules-io commented 1 month ago

error 65 means you didn't setup the proper dev team in xcode

mickeahlinder commented 2 weeks ago

I do not understand how you are event getting to the build phase when using firebasex 16.5.0 and cordova-ios@7.0.0 and above.

When I run cordova platform add ios I just get the following error:

Failed to install 'cordova-plugin-firebasex': TypeError: Cannot set properties of undefined (setting '6DED44EB8FC44F7798319042')
    at Object.addShellScriptBuildPhase (/home/emaz/source/cordova-plugin-firebasex-test/plugins/cordova-plugin-firebasex/scripts/ios/helper.js:86:72)
    at module.exports (/home/emaz/source/cordova-plugin-firebasex-test/plugins/cordova-plugin-firebasex/scripts/ios/after_plugin_install.js:9:12)
    at runScriptViaModuleLoader (/home/emaz/.npm/_npx/ff682b76deb22764/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:32)
    at runScript (/home/emaz/.npm/_npx/ff682b76deb22764/node_modules/cordova-lib/src/hooks/HooksRunner.js:136:12)
    at /home/emaz/.npm/_npx/ff682b76deb22764/node_modules/cordova-lib/src/hooks/HooksRunner.js:108:40
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Cannot set properties of undefined (setting '6DED44EB8FC44F7798319042')

This even happens with a fresh clone of the cordova-plugin-firebasex-test project.

Can someone please shed some light on why this seems to fail on just my computer? It seems like the format of the project-file as changed, and thus this error is thrown. But I still don't understand why it would work for anyone else then :P

EDIT: According to my testing it seems like it is this commit that is causing the issue: https://github.com/apache/cordova-ios/commit/cc111edaec82c528248a7e5b9d0e635804148cec

EDIT 2: A pull-request now exist with a fix for this issue: https://github.com/dpa99c/cordova-plugin-firebasex/pull/890

calvinchu8172 commented 6 days ago

I solved the problem on my own after posting my question few days. The solution is not related to code. I use DevCleaner to clean my Ionic Cordova project's "Derived Data" then re-build the project again in my upgraded Sonoma MacOS(Same version I posted before). I guess there are cache files remain in the previous Ventura MacOS. I am pretty sure all settings are the same including the selected Dev Team.

Normally before re-building the project I also clean all files derived from npm i and ionic cordova build.

ionic cordova platform rm android --verbose
ionic cordova platform rm ios --verbose
rm -rf node_modules plugins platforms www .sourcemaps .gradle .angular
npm cache clean -f

Hope this is helpful to you.