firebase / firebase-ios-sdk

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

Import XCFramework failed #13166

Closed vvorlov closed 1 month ago

vvorlov commented 3 months ago

Description

I'm importing Firebase SDK 10.28.0 via .xcframework files. Run on iOS Simulator and get error about architecture have 'x86_64,arm64', need 'arm64'

dyld[86942]: Library not loaded: @rpath/FBLPromises.framework/FBLPromises
  Referenced from: <11686D59-A985-3C2C-91C8-1B6C25199EB6> /Users/userxxx/Library/Developer/CoreSimulator/Devices/B0933D85-EEDF-4CA5-A806-70C170082945/data/Containers/Bundle/Application/478E4390-9203-4B8B-9956-ADCCCC7C49F2/app.app/app
  Reason: tried: '/Users/userxxx/Library/Developer/Xcode/DerivedData/app-cjzfwlzxbwabmzgdmyjduapdmaof/Build/Products/Debug-iphonesimulator/FBLPromises.framework/FBLPromises' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'x86_64,arm64', need 'arm64'))

lipo

➜  FBLPromises.framework lipo -info FBLPromises
Architectures in the fat file: FBLPromises are: x86_64 arm64 

Reproducing the issue

No response

Firebase SDK Version

10.28.0

Xcode Version

15.4

Installation Method

Zip

Firebase Product(s)

Analytics, Crashlytics, Messaging

Targeted Platforms

iOS

Relevant Log Output

dyld[86942]: Library not loaded: @rpath/FBLPromises.framework/FBLPromises
  Referenced from: <11686D59-A985-3C2C-91C8-1B6C25199EB6> /Users/userxxx/Library/Developer/CoreSimulator/Devices/B0933D85-EEDF-4CA5-A806-70C170082945/data/Containers/Bundle/Application/478E4390-9203-4B8B-9956-ADCCCC7C49F2/app.app/app
  Reason: tried: '/Users/userxxx/Library/Developer/Xcode/DerivedData/app-cjzfwlzxbwabmzgdmyjduapdmaof/Build/Products/Debug-iphonesimulator/FBLPromises.framework/FBLPromises' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'x86_64,arm64', need 'arm64')), '/Library/Developer/CoreSimulator/Volumes/iOS_21C62/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/FBLPromises.framework/FBLPromises' (no such file), '/usr/lib/swift/FBLPromises.framework/FBLPromises' (no such file, not in dyld cache),

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 Replace this line with the contents of your Podfile.lock! ```
google-oss-bot commented 3 months ago

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

rizafran commented 2 months ago

Hi @vvorlov, I can't seem to reproduce the issue. Can you show your Architectures setup in your build settings?

vvorlov commented 2 months ago

@rizafran

image
rizafran commented 2 months ago

Thanks for the info, @vvorlov. I'm still unable to reproduce the issue. Is it possible for you to provide a sample app that reproduces the issue?

vvorlov commented 2 months ago

My project setup:

  1. Pods to manage app dependencies. It installs pod 'PromisesSwift'
    
    platform :ios, '13.0'

use_frameworks! inhibit_all_warnings!

workspace 'TestApp'

pod 'PromisesSwift'

target 'TestApp' do project 'applications/TestApp/TestApp.project' end

target 'FirebaseWrapper' do project 'components/FirebaseWrapper/FirebaseWrapper.project' end

target 'TestComponent' do project 'components/TestComponent/TestComponent.project' end

post_install do |pi| pi.pods_project.targets.each do |t| t.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end

2. The app contains `FirebaseWrapper.framework` that contains Firebase `.xcframeworks`. The framework is generated via `xcodegen`:
```name: FirebaseWrapper
include:
  - path: project.yml
targets:
  FirebaseWrapper:
    type: framework
    platform: iOS
    info:
      path: info.plist
    sources:
      - src
    settings:
      ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: false
      OTHER_LDFLAGS: $(inherited) -ObjC -lc++
      APPLICATION_EXTENSION_API_ONLY: true
      HEADER_SEARCH_PATHS: $(inherited) "Frameworks/"
    dependencies:
      - sdk: libc++.tbd
      - sdk: libsqlite3.tbd
      - sdk: Storekit.framework
      - sdk: SystemConfiguration.framework

      # Firebase Analytics
      - {embed: false, framework: Frameworks/FirebaseAnalytics/FBLPromises.xcframework}
      - {embed: false, framework: Frameworks/FirebaseAnalytics/FirebaseAnalytics.xcframework}
      - {embed: false, framework: Frameworks/FirebaseAnalytics/FirebaseCore.xcframework}
      - {embed: false, framework: Frameworks/FirebaseAnalytics/FirebaseCoreInternal.xcframework}
      - {embed: false, framework: Frameworks/FirebaseAnalytics/FirebaseInstallations.xcframework}
      - {embed: false, framework: Frameworks/FirebaseAnalytics/GoogleAppMeasurement.xcframework}
      - {embed: false, framework: Frameworks/FirebaseAnalytics/GoogleUtilities.xcframework}
      - {embed: false, framework: Frameworks/FirebaseAnalytics/nanopb.xcframework}

      # Firebase Messaging
      - {embed: false, framework: Frameworks/FirebaseMessaging/FirebaseMessaging.xcframework}

      # Firebase Crashlytics
      - {embed: false, framework: Frameworks/FirebaseCrashlytics/FirebaseCoreExtension.xcframework}
      - {embed: false, framework: Frameworks/FirebaseCrashlytics/FirebaseCrashlytics.xcframework}
      - {embed: false, framework: Frameworks/FirebaseCrashlytics/FirebaseRemoteConfigInterop.xcframework}
      - {embed: false, framework: Frameworks/FirebaseCrashlytics/FirebaseSessions.xcframework}
      - {embed: false, framework: Frameworks/FirebaseCrashlytics/Promises.xcframework}
      - {embed: false, framework: Frameworks/FirebaseCrashlytics/GoogleDataTransport.xcframework}

It ends up in conflict with Promises.xcframework and FBLPromises.xcframework since they are included via Podfile and .xcframework manually.

And runtime error:

dyld[62527]: Library not loaded: @rpath/FBLPromises.framework/FBLPromises
  Referenced from: <1C4604A9-D302-30C6-8625-9C96118CA2DA> /Users/xxx/Library/Developer/CoreSimulator/Devices/2D4188F3-CD71-48F5-9755-81C58A3A8119/data/Containers/Bundle/Application/C1A2CD93-4F5A-4156-B6C5-CA684D25DFB6/TestApp.app/TestApp
  Reason: tried: '/Users/xxx/Library/Developer/Xcode/DerivedData/TestApp-agiavxbojzfvprapfyxfamixpebu/Build/Products/Debug-iphonesimulator/FBLPromises.framework/FBLPromises' (file does not start with MH_MAGIC[_64], file does not start with MH_MAGIC[_64], fat file, but missing compatible architecture (have 'x86_64,arm64', need 'arm64')),
google-oss-bot commented 2 months ago

Hey @vvorlov. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

vvorlov commented 2 months ago

@google-oss-bot @rizafran, what information do you need?

paulb777 commented 2 months ago

@vvorlov Thanks for providing the details. We generally don't support mixing installation methods.

The Firebase CocoaPods installation should be compatible with other pods using PromisesSwift, as long as the version specifiers are compatible.

paulb777 commented 1 month ago

Going to close as an unsupported use case.