Swift | GoogleSignIn pod: building for iOS Simulator, but linking in object file built for iOS file for architecture arm64

Viewed 3411

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)
2 Answers

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...

  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

Related