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

Framework in the release assets doesn't work on Apple Silicon Macs. #1239

Open
1 task done
CraigSiemens opened this issue Aug 30, 2023 · 6 comments
Open
1 task done
Assignees

Comments

@CraigSiemens
Copy link
Contributor

CraigSiemens commented Aug 30, 2023

  • I have read CONTRIBUTING and have done my best to follow them.

What did you do?

Installed Quick to a project using Carthage.

What did you expect to happen?

The project should build and run on the simulator.

What actually happened instead?

After adding the framework, got the following error.

Could not find module 'Quick' for target 'arm64-apple-ios-simulator'; found: arm64-apple-ios, at: PROJECT_PATH/Carthage/Build/iOS/Quick.framework/Modules/Quick.swiftmodule

In a simple project it gives a slight different error.

Building for iOS Simulator, but linking in dylib built for iOS, file 'PROJECT_PATH/Quick.framework/Quick' for architecture arm64

It seems like the last two releases have added a Quick.framework.zip asset which Carthage will download and use instead of building Quick itself. Since it's a framework and not an xcframework, it can't be used when running on the simulator on Apple Silicon Macs.

Ideally the release would contain an XCFramework instead, but and easier option is to remove the framework so Carthage will built the correct type for the project.

Environment

List the software versions you're using:

  • Quick: 7.2.0
  • Xcode Version: 14.3
  • Swift Version: 5.8

Please also mention which package manager you used and its version. Delete the
other package managers in this list:

  • Carthage: 0.39.0

Project that demonstrates the issue

QuickFromCarthage.zip

Here's the sample project. It has two schemes/targets, one that uses a .framework and the other that uses a .xcframework. The one using a framework will fail to run on an Apple Silicon Mac. You may need to clean and build when switching schemes, otherwise it might use the Quick framework produced by the other scheme.

@younata
Copy link
Member

younata commented Sep 2, 2023

Weird. Carthage should just support this. But it doesn't. I am using carthage build --archive --use-xcframeworks in the release script. Looking into what Carthage is doing, it's generating Carthage/Build/Quick.xcframework, but the Quick.framework.zip file that it creates doesn't contain that. That feels like a bug in Carthage they should look at. Quick 7.3.0 will use a different script to generate Quick.framework.zip, which will include Carthage/Build/Quick.xcframework.

@younata younata self-assigned this Sep 2, 2023
@younata
Copy link
Member

younata commented Sep 17, 2023

This is fixed in the now-current Quick 7.3.0 and Nimble 12.3.0, which include both xcframework and legacy framework binaries.

@younata younata closed this as completed Sep 17, 2023
@CraigSiemens
Copy link
Contributor Author

Thanks! I'll give it a shot.

@CraigSiemens
Copy link
Contributor Author

Carthage was able to download the XCFramework, but Xcode now fails to to build with the following error.

failed to build module 'Quick'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)', while this compiler is 'Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)'). Please select a toolchain which matches the SDK.

It feels like there's a couple things going on.

  • Our project is still using Swift 5.7 but the XCFramework is now built with 5.8.
  • I believe the swift version used to build a framework must be <= the swift version adding it to a project.
  • Carthage isn't catching that the swift version that built the framework is newer than the swift version, so it completes successfully, but Xcode fails later.

Was it intentional to raise the minimum supported swift version to 5.8? The last related change I can see in the release notes was in https://github.com/Quick/Quick/releases/tag/v6.1.0 dropping support for 5.6.

@younata
Copy link
Member

younata commented Sep 18, 2023

Was it intentional to raise the minimum supported swift version to 5.8?

No, but I did build this using the swift included with Xcode 14.3.1, which is 5.8.

I'm very strongly considering not including prebuilt frameworks because of all these gotchas. For Quick 7.3.0 and Nimble 12.3.0, I'll remove the prebuilt frameworks.

@younata younata reopened this Sep 18, 2023
@CraigSiemens
Copy link
Contributor Author

Removing them would resolve the issue for now. We've also updated our project to not use the binary from Quick.

carthage build --platform iOS --cache-builds --use-xcframeworks --no-use-binaries Quick

Future Improvement Idea

Instead of manually building the frameworks, there could be a GitHub workflow that does it. It could automatically be run when a new release is created on Github. The workflow could be set to use a fixed version of Xcode that contains the minimum supported swift version. Then it's not dependant on the Xcode version installed locally when the release is made, so it wont change based on who is making the release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants