firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.69k stars 1.48k forks source link

Building for 'visionOS-simulator', but linking in object file FIRAAdExposureReporter.o built for 'iOS-simulator' #12591

Open abbana opened 8 months ago

abbana commented 8 months ago

Description

Hi,

I need to have support for iPhone, iPad and now for visionOS. I use CocoaPods. I have Xcode 15.2

I have applied rivera-ernesto workaround from https://github.com/CocoaPods/CocoaPods/issues/12094 and my Podfile is per below

source 'https://github.com/CocoaPods/Specs.git' platform :ios, '15.0' use_frameworks!

target 'XYZ' do

pod 'Firebase', '~> 10.22.0' pod 'FirebaseDatabase', '~> 10.22.0' pod 'FirebaseCore', '~> 10.22.0' pod 'FirebaseAuth', '~> 10.22.0' pod 'FirebaseStorage', '~> 10.22.0' pod 'FirebaseAppCheck', '~> 10.22.0'

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config|

            # Upgrade the minimum version
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'

            # Activate VisionOS support for all Pods
            config.build_settings['SUPPORTED_PLATFORMS'] = 'iphoneos iphonesimulator xros xrsimulator' # Includes VisionOS (xros) and its simulator (xrsimulator)
            config.build_settings['TARGETED_DEVICE_FAMILY'] = '1,2,7' # Incorporate device family '7' for VisionOS
    end

if target.name == 'Cache'
  target.build_configurations.each do |config|

            level = '-Osize'
            config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = level
            puts "Set #{target.name} #{config.name} to Optimization Level #{level}"

    end
end

end end

I do not have a visionpro yet, so I need to use the simulator.

It throws

Building for 'visionOS-simulator', but linking in object file (/Users/aaa/Library/Developer/Xcode/DerivedData15/XYZ-azxtzecwtbuysxhagymjaoytbgqj/Build/Products/Debug-xrsimulator/XCFrameworkIntermediates/FirebaseAnalytics/AdIdSupport/FirebaseAnalytics.framework/FirebaseAnalytics[arm64]3) built for 'iOS-simulator'

I do not use Analytics at all, but I have been told it comes with Core.

How can get this resolved please? Can't integrate the new platform otherwise.

Reproducing the issue

No response

Firebase SDK Version

10.22

Xcode Version

15.2

Installation Method

CocoaPods

Firebase Product(s)

All

Targeted Platforms

iOS, visionOS

Relevant Log Output

Building for 'visionOS-simulator', but linking in object file (/Users/aaa/Library/Developer/Xcode/DerivedData15/XYZ-azxtzecwtbuysxhagymjaoytbgqj/Build/Products/Debug-xrsimulator/XCFrameworkIntermediates/FirebaseAnalytics/AdIdSupport/FirebaseAnalytics.framework/FirebaseAnalytics[arm64][3](FIRAAdExposureReporter.o)) built for 'iOS-simulator'

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
```json Replace this line with the contents of your Package.resolved. ```

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
```yml PODS: - AppCheckCore (10.18.1): - GoogleUtilities/Environment (~> 7.11) - PromisesObjC (~> 2.3) - Firebase (10.22.0): - Firebase/Core (= 10.22.0) - Firebase/Core (10.22.0): - Firebase/CoreOnly - FirebaseAnalytics (~> 10.22.0) - Firebase/CoreOnly (10.22.0): - FirebaseCore (= 10.22.0) - FirebaseAnalytics (10.22.0): - FirebaseAnalytics/AdIdSupport (= 10.22.0) - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - FirebaseAnalytics/AdIdSupport (10.22.0): - FirebaseCore (~> 10.0) - FirebaseInstallations (~> 10.0) - GoogleAppMeasurement (= 10.22.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - FirebaseAppCheck (10.22.0): - AppCheckCore (~> 10.18) - FirebaseAppCheckInterop (~> 10.17) - FirebaseCore (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - PromisesObjC (~> 2.1) - FirebaseAppCheckInterop (10.23.0) - FirebaseAuth (10.22.0): - FirebaseAppCheckInterop (~> 10.17) - FirebaseCore (~> 10.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.8) - GoogleUtilities/Environment (~> 7.8) - GTMSessionFetcher/Core (< 4.0, >= 2.1) - RecaptchaInterop (~> 100.0) - FirebaseAuthInterop (10.23.0) - FirebaseCore (10.22.0): - FirebaseCoreInternal (~> 10.0) - GoogleUtilities/Environment (~> 7.12) - GoogleUtilities/Logger (~> 7.12) - FirebaseCoreExtension (10.23.0): - FirebaseCore (~> 10.0) - FirebaseCoreInternal (10.23.0): - "GoogleUtilities/NSData+zlib (~> 7.8)" - FirebaseDatabase (10.22.0): - FirebaseAppCheckInterop (~> 10.17) - FirebaseCore (~> 10.0) - FirebaseSharedSwift (~> 10.0) - leveldb-library (~> 1.22) - FirebaseInstallations (10.23.0): - FirebaseCore (~> 10.0) - GoogleUtilities/Environment (~> 7.8) - GoogleUtilities/UserDefaults (~> 7.8) - PromisesObjC (~> 2.1) - FirebaseSharedSwift (10.23.0) - FirebaseStorage (10.22.0): - FirebaseAppCheckInterop (~> 10.0) - FirebaseAuthInterop (~> 10.0) - FirebaseCore (~> 10.0) - FirebaseCoreExtension (~> 10.0) - GTMSessionFetcher/Core (< 4.0, >= 2.1) - GoogleAppMeasurement (10.22.0): - GoogleAppMeasurement/AdIdSupport (= 10.22.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - GoogleAppMeasurement/AdIdSupport (10.22.0): - GoogleAppMeasurement/WithoutAdIdSupport (= 10.22.0) - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - GoogleAppMeasurement/WithoutAdIdSupport (10.22.0): - GoogleUtilities/AppDelegateSwizzler (~> 7.11) - GoogleUtilities/MethodSwizzler (~> 7.11) - GoogleUtilities/Network (~> 7.11) - "GoogleUtilities/NSData+zlib (~> 7.11)" - nanopb (< 2.30911.0, >= 2.30908.0) - GoogleUtilities/AppDelegateSwizzler (7.13.0): - GoogleUtilities/Environment - GoogleUtilities/Logger - GoogleUtilities/Network - GoogleUtilities/Privacy - GoogleUtilities/Environment (7.13.0): - GoogleUtilities/Privacy - PromisesObjC (< 3.0, >= 1.2) - GoogleUtilities/Logger (7.13.0): - GoogleUtilities/Environment - GoogleUtilities/Privacy - GoogleUtilities/MethodSwizzler (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - GoogleUtilities/Network (7.13.0): - GoogleUtilities/Logger - "GoogleUtilities/NSData+zlib" - GoogleUtilities/Privacy - GoogleUtilities/Reachability - "GoogleUtilities/NSData+zlib (7.13.0)": - GoogleUtilities/Privacy - GoogleUtilities/Privacy (7.13.0) - GoogleUtilities/Reachability (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - GoogleUtilities/UserDefaults (7.13.0): - GoogleUtilities/Logger - GoogleUtilities/Privacy - GTMSessionFetcher/Core (3.3.1) - leveldb-library (1.22.4) - nanopb (2.30910.0): - nanopb/decode (= 2.30910.0) - nanopb/encode (= 2.30910.0) - nanopb/decode (2.30910.0) - nanopb/encode (2.30910.0) - PromisesObjC (2.4.0) - RecaptchaInterop (100.0.0) DEPENDENCIES: - Firebase (~> 10.22.0) - FirebaseAppCheck (~> 10.22.0) - FirebaseAuth (~> 10.22.0) - FirebaseCore (~> 10.22.0) - FirebaseDatabase (~> 10.22.0) - FirebaseStorage (~> 10.22.0) SPEC REPOS: https://github.com/CocoaPods/Specs.git: - AppCheckCore - Firebase - FirebaseAnalytics - FirebaseAppCheck - FirebaseAppCheckInterop - FirebaseAuth - FirebaseAuthInterop - FirebaseCore - FirebaseCoreExtension - FirebaseCoreInternal - FirebaseDatabase - FirebaseInstallations - FirebaseSharedSwift - FirebaseStorage - GoogleAppMeasurement - GoogleUtilities - GTMSessionFetcher - leveldb-library - nanopb - PromisesObjC - RecaptchaInterop SPEC CHECKSUMS: AppCheckCore: d0d4bcb6f90fd9f69958da5350467b79026b38c7 Firebase: 797fd7297b7e1be954432743a0b3f90038e45a71 FirebaseAnalytics: 8d0ff929c63b7f72260f332b86ccf569776b75d3 FirebaseAppCheck: 8e85fc837a3f006b7c4ef3f50c0a3474395e76f7 FirebaseAppCheckInterop: a1955ce8c30f38f87e7d091630e871e91154d65d FirebaseAuth: bbe4c68f958504ba9e54aee181adbdf5b664fbc6 FirebaseAuthInterop: a458e398bb1e9b71b9b42d46e54acc666b021d0f FirebaseCore: 0326ec9b05fbed8f8716cddbf0e36894a13837f7 FirebaseCoreExtension: cb88851781a24e031d1b58e0bd01eb1f46b044b5 FirebaseCoreInternal: 6a292e6f0bece1243a737e81556e56e5e19282e3 FirebaseDatabase: fee604b3bee8800a1bdc834757d13813cfde1c90 FirebaseInstallations: 42d6ead4605d6eafb3b6683674e80e18eb6f2c35 FirebaseSharedSwift: c92645b392db3c41a83a0aa967de16f8bad25568 FirebaseStorage: bc7bddc743548a89cfb896843a77cf4bdde2c231 GoogleAppMeasurement: ccefe3eac9b0aa27f96066809fb1a7fe4b462626 GoogleUtilities: d053d902a8edaa9904e1bd00c37535385b8ed152 GTMSessionFetcher: 8a1b34ad97ebe6f909fb8b9b77fba99943007556 leveldb-library: 06a69cc7582d64b29424a63e085e683cc188230a nanopb: 438bc412db1928dac798aa6fd75726007be04262 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21 PODFILE CHECKSUM: abf9adf0dbe48a7fcbe2096039f36312a7462f40 COCOAPODS: 1.13.0 ```
google-oss-bot commented 8 months ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

paulb777 commented 8 months ago

FirebaseAnalytics does not support visionOS. There is an open feature request at #12230.

Also, while the CocoaPods workaround may work, we've only tested Firebase via Swift Package Manager for visionOS targets.

paulb777 commented 8 months ago

Remove pod 'Firebase', '> 10.22.0' from the Podfile to stop pulling in Analytics.

paulb777 commented 8 months ago

@abbana Does removing Analytics from the installation address the build issue?

abbana commented 8 months ago

Screenshot 2024-03-20 220225_fixed2 Screenshot 2024-03-20 220121_fixed Hi @paulb777 ,

Removing Analytics resolved the issue.

Now we have a bigger issue that blocks us from proceeding.

Any of the below pulls GoogleDataTransport (9.4.1, latest) which won't run in visionOS Simulator "CoreTelephony is not available when building for visionOS Simulator."

FirebaseCrashLytics FirebaseMessaging GoogleMLKit

which we all use.

They compile perfectly to iOS simulator, and chances to have a physical visionOS are scarse, so we will be blocked till then. Can we have this fixed or workarounded so we can move forward please?

v9.4.1 (CocoaPods Only) The v9.4.0 podspec did not include the intended dependency range for nanopb (https://github.com/firebase/firebase-ios-sdk/issues/12477)

v9.4.0 Add privacy manifest. (#114)

v9.3.0 Added new APIs for attaching product ID data to an event. Fix 0x8BADF00D crashes and add diagnostics. (https://github.com/firebase/firebase-ios-sdk/issues/9859)

v9.2.5 Replace 'TARGET_OS_XR' with 'TARGET_OS_VISION' for compatibility with Xcode 15 Beta 5.

v9.2.4 (SwiftPM Only) Fix build errors on the visionOS platform. (#97)

I tried to open a bug in GoogleDataTransport , but it has redirected us here.

Do I need to fill a new bug for this or is a quick fix?

Thank you.

paulb777 commented 8 months ago

@abbana At first glance that looks like a CocoaPods issue: CoreTelephony is specified only for iOS and OSX in the podspec - https://github.com/google/GoogleDataTransport/blob/main/GoogleDataTransport.podspec#L36.

There may be a way to extend your Podfile workaround to address it, or you may be able to remove CoreTelephony from the linker settings manually after pod installation.

abbana commented 8 months ago

Raised https://github.com/CocoaPods/CocoaPods/issues/12316

Let's give this some more time as in short of ideas on how to proceed further.

Thanks.

abbana commented 8 months ago

Ok,

so after hours of work, we still have this issue left unfortunately. Apple wants us use one unique big app bundle for multiple platforms so we need to go through this pain, so sorry about this.

I have tried multiple thing amongst which the ones you suggested

post_install do |installer|
  installer.pods_project.targets.each do |target|
  puts "\033[33m  scanning platform #{target.platform_name} , target #{target.name}   \033[0m"
  if target.platform_name == :visionos
    if target.name == "GoogleDataTransport"
      target.build_configurations.each do |config|
        config.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework "CoreTelephony"'
              puts "\033[33m  found and removed CoreTelephony on visionOS   \033[0m"      

        end
      end
    end
  end
end

Which gives us something around the lines below

  scanning platform ios , target FirebaseCoreInternal-FirebaseCoreInternal_Privacy   
  scanning platform ios , target FirebaseDatabase   
  scanning platform ios , target FirebaseDynamicLinks   
  scanning platform ios , target FirebaseDynamicLinks-FirebaseDynamicLinks_Privacy   
  scanning platform ios , target FirebaseSharedSwift   
  scanning platform ios , target FirebaseStorage   
  scanning platform ios , target FirebaseStorageUI   
  scanning platform ios , target FirebaseUI  

Of course CocoaPods has just one platform and we have set it ios. We can't distinguish at this stage between the two, so nothing we can do here

In Xcode, under "Frameworks, Libraries and Embedded Content" all are linked to just Pods_.framework , so we can't workaround anything here it either, am I wrong?

I was not able to find in the podspec s.visionos.frameworks = 'SystemConfiguration', while all the other platforms have it, so maybe it defaults to the platform specified in the podfile if not sepcified in the .podspect? I am not an expert and need an help in pinpoint this.

It will be worth adding the s.visionos.frameworks value to the .podspec and try with an ios-visionos empty project if that fixes the built issue.

Let me know if anything I can do from my side.

And thank you.

paulb777 commented 8 months ago

Here's an example of how to manually edit, both in GoogleDataTransport.debug and GoogleDataTransport.release:

Screenshot 2024-03-21 at 2 51 40 PM
abbana commented 8 months ago

Thank you @paulb777 ,

but I haven't found a way to remove that frame either in Xcode or Podfile as after installation task, simply we were not able to.

Also supposing you can effectively remove it from the framework list that way, which is not, you will remove it from all the build targets.

So the only solution I see is that the maintainer, you, fix the repo so that it won't be included for visionOS and visionOS simulator.

paulb777 commented 8 months ago

We haven't yet prioritized CocoaPods support for VisionOS, so we're currently more able to help people using Swift Package Manager for VisionOS builds.

abbana commented 8 months ago

Thank you Paul,

There are some Google Products like MLKit which do not support SPM , see https://github.com/googlesamples/mlkit/issues/180

We use them in Android, iOS, ipadOS, and we should use them on visionOS as well.

Can we have a rough ETA on to when a Firebase project will be able to run for both iOS and visionOS using CocoaPods?

paulb777 commented 8 months ago

We don't yet have an ETA for visionOS via CocoaPods, partly because CocoaPods support for visionOS is still TBD.

I don't think there are any Google products that support visionOS that don't also support Swift Package Manager.

abbana commented 8 months ago

Understood, thank you.