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

Test the wasm32-wasip2 target triple #121634

Closed
brettcannon opened this issue Jul 11, 2024 · 8 comments
Closed

Test the wasm32-wasip2 target triple #121634

brettcannon opened this issue Jul 11, 2024 · 8 comments
Assignees
Labels
build The build process and cross-build OS-wasi

Comments

@brettcannon
Copy link
Member

brettcannon commented Jul 11, 2024

https://bytecodealliance.zulipchat.com/#narrow/stream/394175-SIG-Guest-Languages/topic/Python.20subgroup/near/450807393

Requires #120371 since WASI SDK 22 is required. But this supposedly has some socket support! Downside is any runtime that doesn't support preview2 won't be able to use the file. That probably means adding a flag to wasi.py to control for the target triple as it's currently hard-coded:

HOST_TRIPLE = "wasm32-wasi"

Linked PRs

@brettcannon brettcannon added build The build process and cross-build OS-wasi labels Jul 11, 2024
@Zheaoli
Copy link
Contributor

Zheaoli commented Jul 12, 2024

May I make a try for this?

@brettcannon
Copy link
Member Author

May I make a try for this?

Are you asking about changing wasi.py, or trying to make wasm23-wasip2 work? If it's the latter then dicej@118e9d8 may be of some help.

@Zheaoli
Copy link
Contributor

Zheaoli commented Jul 12, 2024

Sorry for confused reply. I would like to make a try to support wasm32-wasip2

@Zheaoli
Copy link
Contributor

Zheaoli commented Aug 6, 2024

Hi Brett, Sorry for replying too late.

I have made a try to support the socket in p2, but I found some issues. For now, the socket support in p2 is not UNIX compatible. It miss many things that are widely used. For example, getaddrinfo is not usable in p2. This means that we need to wrap https://github.com/WebAssembly/wasi-sockets/blob/main/wit/ip-name-lookup.wit as getaddrinfo in socket module. Otherwise, the socket test can't not be passed in p2 environment. I'm not sure this is acceptable or not

@brettcannon
Copy link
Member Author

@Zheaoli I think some support is better than nothing. I'm okay getting what's there working and then providing the feedback of what's still missing.

@brettcannon
Copy link
Member Author

I've started a branch to at least allow for compiling w/ wasm32-wasip2 regardless of whether any networking is turned on.

@brettcannon
Copy link
Member Author

FYI I will leave this open while I figure out what to do about WASI 0.2 as it's technically a new platform which means buildbot, PEP 11, deciding what to test in CI, etc.

blhsing pushed a commit to blhsing/cpython that referenced this issue Aug 22, 2024
@brettcannon
Copy link
Member Author

OK, so I found out that VS Code's WASI support is not moving over to WASI 0.2 yet because it's a lot of work and the thinking is networking isn't useful w/o threads and those haven't fully landed in WASM yet (I hear Chrome/v8 is the holdup). As such, work isn't as concerned w/ WASI 0.2 and since that would mean I would have to support it as a tier 3 on my own time I'm going to de-emphasize WASI 0.2 and instead focus on more generic things like getting e.g., zlib working (my plans are tracked at https://opensource.snarky.ca/Python/WASI).

So I'm closing this issue as done as my changes to wasi.py means one can do their own WASI 0.2 build w/o issue (just w/o special features turned on).

brettcannon added a commit that referenced this issue Oct 10, 2024
…argument (GH-123030) (GH-123042)

GH-121634: have `wasi.py` accept the host target triple as an argument (GH-123030)
(cherry picked from commit b15b81e)

Co-authored-by: Brett Cannon <brett@python.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build OS-wasi
Projects
None yet
Development

No branches or pull requests

2 participants