Skip to content
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

Add WASI support #228

Open
Kyle-Ye opened this issue Feb 18, 2024 · 7 comments
Open

Add WASI support #228

Kyle-Ye opened this issue Feb 18, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed wasi/wasm WebAssembly support

Comments

@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Feb 18, 2024

Description

Current this build will fail due to some upstream blocked.

Open this issue to track the support for WASI

// ubuntu20 + swiftwasm 5.9.1 https://github.com/swiftwasm/swift
swift test --triple wasm32-unknown-wasi
<unknown>:0: warning: glibc not found for 'wasm32-unknown-wasi'; C stdlib may be unavailable
/Users/kyle/Github/swift-testing/.build/checkouts/swift-syntax/Sources/SwiftCompilerPlugin/CompilerPlugin.swift:103:19: error: cannot find 'dup' in scope
    let inputFD = dup(fileno(stdin))
                  ^~~
/Users/kyle/Github/swift-testing/.build/checkouts/swift-syntax/Sources/SwiftCompilerPlugin/CompilerPlugin.swift:117:20: error: cannot find 'dup' in scope
    let outputFD = dup(fileno(stdout))
                   ^~~
/Users/kyle/Github/swift-testing/.build/checkouts/swift-syntax/Sources/SwiftCompilerPlugin/CompilerPlugin.swift:124:11: error: cannot find 'dup2' in scope
    guard dup2(fileno(stderr), fileno(stdout)) >= 0 else {

Context

I'm maintaining some library which supports WASI. After converting to swift-testing, the WASI CI is failing. I have to disable it for now.

Priority

Low.

Before we add official WASI support in Swift Project. The priority is low here and I only open the issue for keep tracking the progress.

@Kyle-Ye Kyle-Ye added the bug Something isn't working label Feb 18, 2024
@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Feb 18, 2024

cc @kateinoigakukun in case you are interested for pushing this up.

@kateinoigakukun
Copy link
Member

apple/swift-package-manager#7118 will unblock this

@grynspan
Copy link
Contributor

We'd love to support WASI/WASM! Are you able to build to a point where you can see failures in swift-testing yet, or are you blocked by the swift-syntax failures? (Our dependency on swift-syntax is limited to the compiler side of things, so we may be able to hack around the build failures if they cannot reasonably be solved.)

@grynspan grynspan added help wanted Extra attention is needed wasi/wasm WebAssembly support labels Feb 19, 2024
@MaxDesiatov
Copy link
Member

The failures are not caused by swift-syntax or the compiler, it's SwiftPM passing a wrong triple to the Swift Syntax build when compiling dependencies of macros. That was fixed in the PR linked above, but we may need to revert that until we resolve remaining issues with how triple arguments are passed for cross-compiled builds.

@grynspan
Copy link
Contributor

Thank you for the additional info, Max. 🙂 I said swift-syntax because the failures were reported against that package. I understand the nature of the failure here, and that the root cause is because SwiftPM is building our macro target and its dependencies for the target platform.

@Kyle-Ye
Copy link
Contributor Author

Kyle-Ye commented Feb 20, 2024

The failures are not caused by swift-syntax or the compiler, it's SwiftPM passing a wrong triple to the Swift Syntax build when compiling dependencies of macros. That was fixed in the PR linked above, but we may need to revert that until we resolve remaining issues with how triple arguments are passed for cross-compiled builds.

Thanks for the tip. Would you mind cc me when the issue is eventually fixed to the nightly toolchain as I may not check the PRs on SwiftPM frequently?

@grynspan grynspan added enhancement New feature or request and removed bug Something isn't working labels Feb 23, 2024
@grynspan
Copy link
Contributor

As an administrative thing, I'm going to mark issues asking for new platform support as enhancements rather than bugs. (Carry on!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed wasi/wasm WebAssembly support
Projects
None yet
Development

No branches or pull requests

4 participants