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

Allow using WASI APIs in the Python extension #533

Merged
merged 4 commits into from
Nov 11, 2019

Conversation

alexcrichton
Copy link
Member

This commit adds support to the Python extension to load the WASI
implementation when a WASI module is seen allowing Python to load
WebAssembly modules that use WASI. This is pretty primitive right now
because there's no way to configure the environment/args/preopens/etc,
but it's hoped to be at least a start!

for import in section {
let import = import?;
match import.module {
"wasi" | "wasi_unstable" => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this logic was lifted up from below to work for modules that don't have an interface types section as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasi_snapshot_* will soon be becoming a thing, so we should add .starts_with("wasi_snapshot_*") here too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure yeah, I went ahead and refactored this a bit as well to hopefully future proof slightly. I think to support multiple wasi interfaces we'll need a bit more logic with wasmtime-wasi anyway.

@alexcrichton
Copy link
Member Author

I believe the failure here is because our builds require glibc 2.6 due to our usage of the utimensat symbol. I think this is basically the same as #516 where we should be dynamically detecting it at runtime with appropriate fallbacks.

I'll look into fixing this on Monday.

@alexcrichton
Copy link
Member Author

Yay green CI!

This shouldn't be merged, however, until #535 is merged and I rebase on that.

This commit adds support to the Python extension to load the WASI
implementation when a WASI module is seen allowing Python to load
WebAssembly modules that use WASI. This is pretty primitive right now
because there's no way to configure the environment/args/preopens/etc,
but it's hoped to be at least a start!
* Move the check into `wasmtime-wasi` itself
* Make it conservative for now and match anything that says `wasi*`
* Leave a `FIXME` for improving this later on
@alexcrichton
Copy link
Member Author

Ok should be good to go now!

@sunfishcode sunfishcode merged commit d9edb95 into bytecodealliance:master Nov 11, 2019
@alexcrichton alexcrichton deleted the python-wasi branch November 11, 2019 19:12
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.

2 participants