-
Notifications
You must be signed in to change notification settings - Fork 16
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
Enable host toolchain on macOS by default, improve README.md
#196
base: main
Are you sure you want to change the base?
Enable host toolchain on macOS by default, improve README.md
#196
Conversation
- It can still be disabled, but most people would want to include it when just building a Swift SDK with minimal params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. I'm not fond of requiring --target
with a full triple name these days, as it's mostly CPU arch that users care about, and other triple components can (and should be) inferred. But that's something to do in the future, not blocking for this PR.
@swift-ci test |
Also, thought I would share. I was talking to the author of SwiftToolkit.dev yesterday and he ran into the same issue as others had with using Swift SDKs generated on macOS without the host toolchain. I explained to him that However, he did write a nice post about running Swift on the Raspberry Pi, which is well supported now for aarch64 PIs: |
Yeah, especially since we only ever generate Swift SDKs to cross-compile to Linux it doesn't seem useful to have to include the whole triple all the time. So something like this could be awesome in the future: --target x86_64
--target aarch64
--target armv7 Or, even let it take alternate names too: --target amd64
--target arm64
--target arm # could default to armv7 since this is the latest arm "32-bit" supported |
We previously had this called |
Was it
|
It makes sense to me to alias known arch names to recipe-specific defaults. I made the option to accept a full triple to be able to handle "environment" part difference but I understand it's not always necessary. |
So, I wonder if maybe using Then if you need something that's not a Linux platform, just use the whole triple argument instead... |
Surely doable, ideally accounting for possible future Musl support (hence |
@swift-ci test |
@swift-ci test |
Right now if I give the swift-sdk-generator the
And the end result is a Swift SDK for the wrong arch and not what I wanted:
So my question is- should we revive the use of the --target-arch param as an alternative to the use of --target, and of course it'll just default to *-linux-gnu as it does now? func deriveTargetTriple(hostTriple: Triple) -> Triple {
if let target = generatorOptions.target {
return target
}
if let arch = generatorOptions.targetArch {
let target = Triple(arch: arch, vendor: nil, os: .linux, environment: .gnu)
appLogger.warning(
"deprecated: Please use `--target \(target.triple)` instead of `--target-arch \(arch)`")
}
return Triple(arch: hostTriple.arch!, vendor: nil, os: .linux, environment: .gnu)
} I can also update the README.md to recommend using |
…--target for different platforms + environments
README.md
…d typo in GeneratorError.unknownLinuxDistribution
…github.com/xtremekforever/swift-sdk-generator into swiftlang#189-macos-host-toolchain-default
@swift-ci test |
1 similar comment
@swift-ci test |
@swift-ci test |
I put this against #189 since it adds some documentation to help with common issues people run into. But primarily, this PR sets
--host-toolchain
on macOS by default, since most people are using Xcode and not the Swift OSS toolchain to run the generator and build using generated Swift SDKs.