-
Notifications
You must be signed in to change notification settings - Fork 141
Miscellaneous fixes for Wasm platform toward SwiftPM integration #998
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
base: main
Are you sure you want to change the base?
Conversation
An artifact variant path allows specifying either a directory containing a `swift-sdk.json` file or the path to the `swift-sdk.json` file itself. Swift SDK for WebAssembly uses this feature to collocate regular SDK and embedded SDK.
…r is supported After swiftlang#236, we no longer need to manually add Swift specific linker flags in the WebAssembly SDK.
| // The sdkCanonicalName from a Platform is not guaranteed to be available | ||
| let defaultSDKAvailable: Bool | ||
| do { | ||
| let foundSDK = try workspaceContext.core.sdkRegistry.lookup(sdkRoot, activeRunDestination: parameters.activeRunDestination) | ||
| defaultSDKAvailable = foundSDK != nil | ||
| } catch { | ||
| defaultSDKAvailable = false | ||
| } | ||
| if defaultSDKAvailable { | ||
| overrides["SDKROOT"] = sdkRoot | ||
| } |
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.
I'm not 100% sure if this is the right approach. Do we really need to override SDKROOT here in the first place? The overridden SDKROOT was always platform.sdkCanonicalName, which is always the same as platform.name ("webassembly"), but "webassembly" SDK is unavailable.
I'm a bit lost here because I can't access the git history before it got open-sourced.
Some targets use the resource dir during linking to find files like `static-executable-args.lnk` in swift-driver and compiler-rt libraries in clang. They are normally located under the Swift `-sdk` path or `-sysroot` path, but Swift SDK for Wasm located resource dirs outside of `-sdk`/`-sysroot` path. This patch adds `-resource-dir` flag to the linker driver invocation.
…ot` for now The override is needed because swift-driver currently does not respect `-sysroot` for Wasm targets, but only `-sdk`. This will be fixed in swift-driver in the change: swiftlang/swift-driver#2053
57584f0 to
7f3e767
Compare
XDG_CONFIG_HOMEon non-macOS-resource-dirto linker driver-sdkover-sysrootfor nowSDKROOTonly if SDK is availableClose swiftlang/swift-package-manager#9364