Skip to content

Add support for iOS triples in swift build #6572

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

Conversation

aleksproger
Copy link
Contributor

@aleksproger aleksproger commented May 17, 2023

Add support for iOS/iOS Simulator triples in swift build

Motivation:

Fixes the issue - #6571
Details provided there

Modifications:

  • Add parsing of ios/ios-simulator triples
  • Add parsing of SupportedPlatformVariant to XCFrameworkMetadata
  • Add ios to Triple.OS and simulator to Triple.ABI

Result:

  • swift build accepts the following triples arm64/x86_64-apple-ios, arm64/x86_64-apple-ios-simulator
  • SwiftPM able to resolve the necessary XCFramework slice for provided triple

@aleksproger
Copy link
Contributor Author

aleksproger commented May 17, 2023

Will add tests later after settling things down and if the change would be accepted:)

@tomerd
Copy link
Contributor

tomerd commented May 17, 2023

cc @neonichu

@aleksproger aleksproger marked this pull request as draft May 18, 2023 10:06
Aleksei added 3 commits May 18, 2023 21:30
**Content**
- Added logic to resolve SDK paths whe building for Appli platforms
- Added specific structure PlatformSDKPaths insted of simple tuple to represetn paths for platform headers/sdk
- Destination.defaultDestination now instead of silent fallback to host emits error when triple is not supported
- Added changes from swiftlang#6380 to pass --target fla to clang/swiftc with provided triple
- Added validation of supported triples in applePlatformDestination() to ensure correct combination and enforce specifying the os version
@aleksproger
Copy link
Contributor Author

@neonichu @MaxDesiatov any thoughts on this?
By the way, previously it was non-obvious that one cannot build triples for non-Mac Apple platforms, while you may chose .iOS and others in platforms section. And lack of descriptive errors also forced to dig into the details of what's going on. So, at least more descriptive error messages could be added.

@aleksproger aleksproger marked this pull request as ready for review May 24, 2023 13:21
@kabiroberai
Copy link
Contributor

This is promising! A couple of things to note:

  • You probably want to update BuildParameters.targetTripleArgs(for:) to handle iOS as well
  • It'd be even better if this supported other Darwin triples: the Swift Driver has a more comprehensive representation of LLVM triples here

@aleksproger
Copy link
Contributor Author

aleksproger commented Jul 18, 2023

@kabiroberai Yeah, regarding to the more comprehensive triples representation. In parallel to my pull-request there were a change to how SPM interacts with LLVM triple here:
#6627
That's why I didn't make any changes to this PR. For now it's assigned to @neonichu so seems like guys from Apple picked this up, but if not I may continue to work on this and make updates

@kabiroberai
Copy link
Contributor

Ah that's great, it looks like the Triple changes just haven't been cherry-picked into 5.9. Interestingly the targetTripleArgs bug (assuming darwin == macOS) exists on main as well so I might throw up a PR to fix that.

@neonichu
Copy link
Contributor

Sorry, this PR is just assigned to me to review it, but I haven't had a chance to do so.

@kabiroberai
Copy link
Contributor

kabiroberai commented Jul 20, 2023

Decided to take a crack at this with the new Triple type + UserToolchain changes: #6732. @aleksproger I'd be happy to push my changes to your branch instead if you wanna give me write access.

@neonichu
Copy link
Contributor

neonichu commented Sep 5, 2023

@kabiroberai I think we can close this in favor of #6732, right?

@kabiroberai
Copy link
Contributor

@neonichu yep!

@MaxDesiatov MaxDesiatov closed this Sep 6, 2023
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

Successfully merging this pull request may close these issues.

5 participants