Skip to content

Conversation

@kateinoigakukun
Copy link
Member

  • SwiftSDK: Support specifying metadata JSON path as an artifact variant
  • SwiftSDK: Fix default Swift SDKs directory to respect XDG_CONFIG_HOME on non-macOS
  • Wasm: Remove obsolete linker flags hacks now that swiftc linker driver is supported
  • Pass -resource-dir to linker driver
  • Wasm: Override SWIFTC_SDKROOT_LINKER_INPUT to use -sdk over -sysroot for now
  • SWBCore: Impose SDKROOT only if SDK is available

Close swiftlang/swift-package-manager#9364

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.
Comment on lines +209 to +219
// 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
}
Copy link
Member Author

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
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.

wasm Swift SDK doesn't work with swiftbuild

1 participant