-
Notifications
You must be signed in to change notification settings - Fork 1.4k
C++ code fails to find libc++ headers using the WebAssembly Swift SDK #8465
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
Labels
Comments
It looks like this "defaultSwiftSDK" function is actually behaving as a sort of override. Should the WASI branch in there simply be removed? @MaxDesiatov, I'm assuming you have the most knowledge in this area. |
So I think this issue can be split into two issues:
|
MaxDesiatov
pushed a commit
that referenced
this issue
Apr 9, 2025
Remove hardcoded WASI sysroot path derivation just for wasi-sysroot embedded in toolchains ### Motivation: The previous implementation assumed there is $TOOLCHAIN_ROOT/share/wasi-sysroot when `--triple wasm32-unknown-wasi` is passed, but this is no longer the case with the [deprecation of the Wasm toolchain installation](swiftwasm/swift#5604) in favor of Swift SDKs. Due to this unnecessary branch, when `--triple wasm32-unknown-wasi` is passed together with `--swift-sdk`, `--swift-sdk` is just ignored: #8465 ### Modifications: This change removes the hardcoded path derivation for the WASI sysroot from the `SwiftSDK.deriveTargetSwiftSDK` method. ### Result: When `--triple wasm32-unknown-wasi` is passed without `--swift-sdk`, no user visible change and they will keep getting the following: ``` error: emit-module command failed with exit code 1 (use -v to see invocation) <unknown>:0: warning: libc not found for 'wasm32-unknown-wasi'; C stdlib may be unavailable <unknown>:0: error: unable to load standard library for target 'wasm32-unknown-wasi' ``` When `--triple wasm32-unknown-wasi` is passed together with `--swift-sdk`, `--triple` is ignored and `--swift-sdk` is respected.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
Builds will fail to find standard C++ headers when using a WebAssembly Swift SDK.
This is due to the following code in SwiftPM passing a hardcoded sysroot (using
--sysroot
) for WASM triples:On my system, that expands to:
which does not exist. The actual path should be:
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
git clone https://github.com/swiftlang/swift-build
cd swift-build
swift build --triple wasm32-unknown-wasi --swift-sdk swift-wasm-6.1-RELEASE-wasm32-unknown-wasi
Swift Package Manager version/commit hash
6.1-RELEASE
Swift & OS version (output of
swift --version ; uname -a
)Apple Swift version 6.1 (swift-6.1-RELEASE)
Target: arm64-apple-macosx15.0
The text was updated successfully, but these errors were encountered: