invertase / firestore-ios-sdk-frameworks

⚡ Precompiled Firestore iOS SDKs extracted from the Firebase iOS SDK repository release downloads for faster build times.
Apache License 2.0
427 stars 48 forks source link

ld: symbol(s) not found for architecture arm64 #71

Closed roman-mazanka closed 7 months ago

roman-mazanka commented 1 year ago

During the XCode cli build (in Azure DevOps, Microsoft hosted agent, macOS-11, macOS-12) the error appear:

❌  ld: symbol(s) not found for architecture arm64

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Run script build phase 'Copy www directory' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target '<AppName>' from project '<AppName>')
    Run script build phase 'Crashlytics' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target '<AppName>' from project '<AppName>')
** BUILD FAILED **

The following build commands failed:
    Ld /Users/runner/Library/Developer/Xcode/DerivedData/<AppName>-baugolxbeqirlgfbsumodscnhkyc/Build/Products/Release-iphoneos/<AppName>.app/<AppName> normal (in target '<AppName>' from project '<AppName>')
(1 failure)

I've tried modifying Podfile with the following: 1) config.build_settings['ENABLE_BITCODE'] = 'NO' 2) config.build_settings['ENABLE_BITCODE'] = 'YES' 3) config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'

Nothing helped.

The error appeared after upgrading cordova-plugin-firebasex 13.0.1 -> 15.0.0 and setting IOS_USE_PRECOMPILED_FIRESTORE_POD = true. Upgrading to 16.0.0 doesn't solve the issue.

mikehardy commented 1 year ago

🤔 I wonder what version of Xcode is in use? The general assumption is that current Xcode is in use, but the specific requirement is Xcode 13.3.1+ I think https://github.com/firebase/firebase-ios-sdk/#development

Could have bearing? Strangely enough, you may want to exclude i386 and see if that helps, vs excluding arm64

roman-mazanka commented 1 year ago

I've tried both Xcode 13.2.1 (default on macOS-11) and Xcode 14.2 (default on macOS-12).

roman-mazanka commented 1 year ago

tried adding: config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'i386' didn't help also.

mikehardy commented 1 year ago

macOS 11 (with Xcode 13.2.1) is definitely out, I wouldn't continue trying that as it simply doesn't meet requirements.

macOS-12 with Xcode 14.2 should be working, there will be some combination of magic "please Xcode build this" flags that will work.

You might want to make certain you are using use_frameworks! :linkage => :static, and you don't mention what symbol is missing (stated differently: your error message above is incomplete, so we have incomplete information to make guesses on here), but it may be fixed by making sure the right transitive pods are included, e.g. #63 or #68

lucaele commented 1 year ago

Podfile with <pod 'FirebaseFirestore', '10.2.0'>, build works, Podfile with <pod 'FirebaseFirestore', :tag => '10.2.0', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git'>, build not works

symbol(s) not found for architecture arm64

Any idea?

gillycheesesteak commented 1 year ago

Make sure you are running your terminal and every step of the process through Rosetta. I had to even reinstall CocoaPods using Rosetta iirc

As @mikehardy mentioned below, this does appear to work natively on M1 now

mikehardy commented 1 year ago

I have these working using arm64 native toolchains, 0% rosetta on M1 machines, for what it's worth.

The only people that are still using Rosetta may be the machine learning community with some of their dependencies but I bet even they have updated in the year since I have been paying attention.

Just to say, Rosetta may be a solution you need (at which point you need to use Rosetta 100% for everything, yes), but M1 native should work now.

loozmax commented 1 year ago

Having this issue in xcode 14.2 after adding firebase to the project (i guess) Spend weeks but still dont have any solution

but despite this error, I can run the application on a real device but not on emulator

macos 13

My podfile

source 'https://cdn.cocoapods.org/' platform :ios, '11.0' use_frameworks! target 'Business' do project 'Business.xcodeproj' pod 'Firebase/Core', '8.11.0' pod 'Firebase/Auth', '8.11.0' pod 'Firebase/Messaging', '8.11.0' pod 'Firebase/Performance', '8.11.0' pod 'Firebase/RemoteConfig', '8.11.0' pod 'FirebaseFirestore', :tag => '8.11.0', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git' pod 'Firebase/Crashlytics', '8.11.0' pod 'Firebase/Functions', '8.11.0' pod 'Firebase/Installations', '8.11.0' pod 'GoogleSignIn', '6.1.0' pod 'GoogleMLKit/BarcodeScanning', '~> 2.6.0' end

mikehardy commented 10 months ago

If this isn't working for people, I encourage switching back to the raw code (vs this pre-compiled repackage) from firebase-ios-sdk and instead accelerating your build with a compiler cache as detailed here https://reactnative.dev/docs/build-speed#use-a-compiler-cache

LeonardoRosaa commented 10 months ago

I'm facing a similar error here in a M1 machine, and it works after switching back to the raw code.