5

I have a problem with running a project in the simulator on M1 (there is no problem with such a real device). After installing the GoogleSignIn pod, the project stopped compiling for the simulator with the following error - https://tppr.me/JpMll

building for iOS Simulator, but linking in object file built for iOS, file '/......../GoogleSignIn.framework/GoogleSignIn' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Tried every possible solution (feeling that they are all under Xcode version up to 12). It also does not help to specify forcibly in the arm64 settings: other pods fall off (FirebaseAuth, Firebase/Analytics, Firebase/Firestore, Firebase/Storage).

There is a feeling that it is necessary to force the start of the arm64 engine only for the "problem" pod (in my case, it is GoogleSignIn). Then the question is, how can this be done, and is it possible at all?

Podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'iChat' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for iChat
  pod 'Firebase/Analytics'
  pod 'GoogleSignIn'
  pod 'Firebase/Auth'
  pod 'Firebase/Firestore'
  pod 'Firebase/Storage'
  pod 'SDWebImage'

end

Pod Version:

Installing AppAuth (1.4.0)
Installing BoringSSL-GRPC (0.0.7)
Installing Firebase (7.11.0)
Installing FirebaseAnalytics (7.11.0)
Installing FirebaseAuth (7.11.0)
Installing FirebaseCore (7.11.0)
Installing FirebaseCoreDiagnostics (7.11.0)
Installing FirebaseFirestore (7.11.0)
Installing FirebaseInstallations (7.11.0)
Installing FirebaseStorage (7.11.0)
Installing GTMAppAuth (1.2.1)
Installing GTMSessionFetcher (1.5.0)
Installing GoogleAppMeasurement (7.11.0)
Installing GoogleDataTransport (8.4.0)
Installing GoogleSignIn (5.0.2)
Installing GoogleUtilities (7.3.1)
Installing PromisesObjC (1.2.12)
Installing SDWebImage (5.11.1)
Installing abseil (0.20200225.0)
Installing gRPC-C++ (1.28.2)
Installing gRPC-Core (1.28.2)
Installing leveldb-library (1.22.1)
Installing nanopb (2.30908.0)
Zoe
  • 27,060
  • 21
  • 118
  • 148
Andreas
  • 51
  • 1
  • 5
  • Please ensure your podfile is up-to-date and the CocoaPods app is as well. Check with `pod --version` and it should be 1.10.1 or later. Update with `sudo gem install cocoapods`. Then, M1 Processors may require a special version of FirebaseAnalytics, depending on which version of Firebase you're using. See this github [Apple Silicon Simulator Support](https://github.com/firebase/firebase-ios-sdk/blob/master/AppleSilicon.md). Simply updating your cocoapods may resolved the issue with Firebase 7.5 and above. – Jay Apr 25 '21 at 14:49
  • I checked. I have the latest version of cocoapods installed (1.10.10) – Andreas Apr 25 '21 at 15:02
  • ....and...? What about your podfile? Analytics? Version of Firebase? – Jay Apr 25 '21 at 15:36
  • something like this - https://tppr.me/ZE0NG Do I need to give each one a version? – Andreas Apr 25 '21 at 16:27
  • Include your podfile in the question as well as what versions of each pod you have. – Jay Apr 25 '21 at 17:46
  • Ready - https://drive.google.com/file/d/1s8WYZ8911L5vd5nC3QJz39bOWN8TcLoU/view?usp=sharing – Andreas Apr 25 '21 at 18:03
  • Please don’t include images or links in questions. Include code and structures as text so we can use them in answers with copy/paste. See [images and links are evil](http://idownvotedbecau.se/imageofcode). Images and links are not searchable so they may not be of use to future readers. Also, links can break and if that happens, it would invalidate the question making it not useful to future readers. – Jay Apr 25 '21 at 21:27
  • Added the content of the pod file to the question – Andreas Apr 26 '21 at 06:24
  • Excellent. Now tell us what versions of those pods are being used. Do you have Firebase 7.5 or above? e.g. have you done `pod update` on your project? It's important to include that kind of information in your initial question so we have a big picture. – Jay Apr 26 '21 at 17:18
  • I updated all my pods and added all pod versions in question – Andreas Apr 26 '21 at 18:18
  • I have 7.11 firebase version – Andreas Apr 26 '21 at 18:19
  • Ok then. Did you review the links I provided above? Here they are again [Apple Silicon Simulator Support](https://github.com/firebase/firebase-ios-sdk/blob/master/AppleSilicon.md) which states **Starting with Firebase 7.5.0, Firebase supports Apple Silicon Macs via CocoaPods** meaning if you have 7.11, which is less than 7.5, you would need the **The special M1 versions required for FirebaseAnalytics support** so you need to update to 7.5 as previously mentioned. Try that and let us know! – Jay Apr 26 '21 at 18:31
  • Thank you, Jay. I figured out what the problem was. I tried to update all pods with the pod install command, but firebase also remains on version 7.11. I also tried the "pod deintegrate" and "pod clean" commands. Could you tell me if there is any other way to update Firebase? – Andreas Apr 26 '21 at 20:24
  • And in my pod file just 6 pods, but after pod update command there are much more dependencies appears in console – Andreas Apr 26 '21 at 20:27
  • I have the same issue, and only one pod is in the list: GoogleSignIn. When I remove it, all works fine. Tried all cases, no result... – djdance Jul 01 '21 at 16:25
  • +++ Still have the problem – Andreas Jul 02 '21 at 10:20

2 Answers2

5

Recently I had the same warning when trying to build an ios project with Flutter...

I tried following the steps on the firebase documentation by installing the pods manually, but it did not work out.

After days of scrolling through the Firebase-ios-sdk repository, I tried to override the firebase dependencies of my podfile by using $FirebaseSDKVersion = '8.0.0'

After that, I deleted all of the firebase specified pod such as pod 'Firebase/Analytics' etc...

AND regarding your issue, which was the linking object issue, I found this question and tried to follow the solution

I add another line to my podfile after the post_install do |installer|

And my post_install looks like this

post_install do |installer| 
   installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
     config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
     config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end

After that, all of the errors are gone and my app is working perfectly...

Zoe
  • 27,060
  • 21
  • 118
  • 148
Bettabus
  • 461
  • 4
  • 9
3
  1. add post_install on Podfile
    post_install do |installer|  
      installer.pods_project.build_configurations.each do |config|   
        config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'   
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"  
      end
    end
    
  2. After adding this code install pod
    pod install or pod update
    
  3. Go to Project Targets --> Build Settings --> Debug --> add "arm64" in Any SDK enter image description here

Good luck

ArNo
  • 2,278
  • 1
  • 22
  • 19