Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only five of six xcframeworks get installed from the specified zip #3185

Closed
paulb777 opened this issue May 19, 2021 · 8 comments
Closed

Only five of six xcframeworks get installed from the specified zip #3185

paulb777 opened this issue May 19, 2021 · 8 comments
Labels

Comments

@paulb777
Copy link

  • carthage install method: [ ] .pkg, [X ] homebrew, [ ] source
  • which carthage: /usr/local/bin/carthage
  • carthage version: 0.38.0
  • xcodebuild -version: Xcode 12.5
  • Are you using --no-build? No
  • Are you using --no-use-binaries? No
  • Are you using --use-submodules? No
  • Are you using --cache-builds? No
  • Are you using --new-resolver? No

Cartfile

binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json"

Carthage Output

*** Downloading binary-only framework FirebaseFirestoreBinary at "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json"
*** Downloading binary-only framework FirebaseFirestoreBinary at "https://dl.google.com/dl/firebase/ios/carthage/FirebaseFirestoreBinary.json"
*** xcodebuild output can be found in /var/folders/mk/9ccbvq8x00q20q0f7mfxbtrw00bzqz/T/carthage-xcodebuild.Iz3UvV.log
*** Downloading FirebaseFirestoreBinary binary at "8.0.0"

Actual outcome

$ ls Carthage/Build/
BoringSSL-GRPC.xcframework	abseil.xcframework		leveldb-library.xcframework
FirebaseFirestore.xcframework	gRPC-Core.xcframework

Expected outcome
Carthage should have also installed gRPC-C++.xcframework

After downloading https://dl.google.com/dl/firebase/ios/carthage/8.0.0/FirebaseFirestore-6c7035fccbea27c0.zip in the browser and unzipping:

$ ls ~/Downloads/FirebaseFirestore
BoringSSL-GRPC.xcframework	abseil.xcframework		gRPC-Core.xcframework
FirebaseFirestore.xcframework	gRPC-C++.xcframework		leveldb-library.xcframework

Original report at firebase/firebase-ios-sdk#7576 (comment) and also tracked at firebase/firebase-ios-sdk#8112

@elliottwilliams
Copy link
Contributor

Interesting. The problem seems to be that Foundation isn't parsing any of the fields of the Info.plist in gRPC-C++.xcframework:

$ swift
Welcome to Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28).
Type :help for assistance.
  1> import Foundation
  2> Bundle(path: "gRPC-C++.xcframework")!.infoDictionary
$R0: [String : Any]? = 0 key/value pairs

@paulb777 do you if this framework had trouble in earlier versions of Carthage? Obviously not as an xcframework, but I'm curious if the system doesn't like the + character in the name or something like that.

@elliottwilliams
Copy link
Contributor

Figured it out: gRPC-C++.xcframework has a Resources folder, which appears to screw up the whole bundle system:

$ tree -L 2 gRPC-C++.xcframework/
gRPC-C++.xcframework/
├── Info.plist
├── Resources
│   └── gRPCCertificates-Cpp.bundle
├── ios-arm64_armv7
│   └── gRPC-C++.framework
├── ios-arm64_i386_x86_64-simulator
│   └── gRPC-C++.framework
├── ios-arm64_x86_64-maccatalyst
│   └── gRPC-C++.framework
├── macos-arm64_x86_64
│   └── gRPC-C++.framework
├── tvos-arm64
│   └── gRPC-C++.framework
└── tvos-arm64_x86_64-simulator
    └── gRPC-C++.framework

Removing that directory causes Foundation to be able to load it fine.

@paulb777 do you happen to know if that directory was put in the xcframework manually, or if this is from a legitimate xcodebuild -create-xcframework invocation? Since this xcframework seems to break the OS's bundle API, this doesn't strike me as a Carthage problem.

FWIW, renaming the directory to anything other than "Resources" fixes the issue.

If we were to try to accomodate this case, we'd have to fall back to manually loading and parsing the Info.plist here:

guard let bundle = Bundle(url: url) else {

@paulb777
Copy link
Author

@elliottwilliams Thanks for the investigation and sharing the analysis! And sorry about my lack of responsiveness. I was off last week.

We do use xcodebuild -create-xcframework to create the xcframework but then move the Resources. See https://github.com/firebase/firebase-ios-sdk/blob/master/ReleaseTooling/Sources/ZipBuilder/FrameworkBuilder.swift#L697. Perhaps, that move shouldn't be there? I'll investigate this week. Any suggestions welcome.

There is still arguably a Carthage issue that it should give an error message for an unparsed xcframework instead of silently failing to install.

@cassianodialpad
Copy link

@paulb777 The same is happening with FirebaseInAppMessagingBinary (using carthage 0.38.0):

Cartfile

binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseInAppMessagingBinary.json" == 8.0.0

Carthage Output

*** Downloading binary-only framework FirebaseInAppMessagingBinary at "https://dl.google.com/dl/firebase/ios/carthage/FirebaseInAppMessagingBinary.json"
*** Downloading binary-only framework FirebaseInAppMessagingBinary at "https://dl.google.com/dl/firebase/ios/carthage/FirebaseInAppMessagingBinary.json"
*** xcodebuild output can be found in /var/folders/1m/qtjwktc57nl09cm7k2j4d29r0000gp/T/carthage-xcodebuild.7OXlH6.log

Actual outcome

ls Carthage/Build 
FirebaseABTesting.xcframework

Expected outcome
Carthage should have also installed FirebaseInAppMessaging.xcframework

After downloading https://dl.google.com/dl/firebase/ios/carthage/8.0.0/FirebaseInAppMessaging-7bb7459ed9f4d27d.zip in the browser and unzipping:

ls ~/Downloads/FirebaseInAppMessaging
FirebaseABTesting.xcframework		FirebaseInAppMessaging.xcframework

@paulb777
Copy link
Author

paulb777 commented Jun 11, 2021

@cassianodialpad Yep. It's the same Firebase issue since FirebaseInAppMessaging also has resources. The fix from firebase/firebase-ios-sdk#8182 will be available in the upcoming Firebase 8.2.0 release. In the meantime, see firebase/firebase-ios-sdk#8112 for workaround info.

@cassianodialpad
Copy link

@paulb777 Awesome, thanks!

@elliottwilliams
Copy link
Contributor

There is still arguably a Carthage issue that it should give an error message for an unparsed xcframework instead of silently failing to install.

@paulb777 Agreed. If there's a decent way to plumb this through the codebase I'd like to do it. The "right" way to do this would likely be to add a new ProjectEvent case and send the warning via the Project._projectEventsObserver, when Carthage tries to install a prebuilt binary and it doesn't appear to be a valid framework.

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 9, 2022
@stale stale bot closed this as completed Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants