-
Notifications
You must be signed in to change notification settings - Fork 42
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 wasm32-wasi-musl target #165
Conversation
Since you are changing the final archive, you will need to add this here:
|
Ah thanks! I see what's happening now. That was non obvious 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, but we need a way to run and verify that the binary runs at least on one platform.
I see the following options:
- Use a system package and run with
--run_under
. MacOS and Windows seems to be available, orcurl <...> | bash
on Ubuntu. - Get a "lightweight" runtime and use it. The most lightweight I found and was able to quickly run was from zig itself:
code/zig/stage1$ zig cc -O3 -target x86_64-linux-musl wasm2c.c -o wasm2c
code/zig/stage1$ ./wasm2c ~/code/hermetic_cc_toolchain/bazel-bin/test/c/which_libc-__platform_wasip1_wasm hello.c
code/zig/stage1$ zig cc -O3 -target x86_64-linux-musl hello.c wasi.c -o hello
code/zig/stage1$ ./hello foo
wasi non-glibc
This one should work on all platforms. You are welcome to explore any options.
I have used a go based wasm runtime to verify this within Bazel. PTAL |
I see snyk is unhappy. Please advise 😄 |
wazero is a great find! This is coming together pretty nicely. I am replacing
My WIP branch is in https://github.com/motiejus/hermetic_cc_toolchain/tree/test_go , feel free to keep an eye for a PR here too. |
- run all tests on all platforms. - enable more CI checks on more platforms. Turns out I just missed quite a few. - replace `test.sh` with `test.go`, which will be useful in uber#165
- run all tests on all platforms. - enable more CI checks on more platforms. Turns out I just missed quite a few. - replace `test.sh` with `test.go`, which will be useful in uber#165
- run all tests on all platforms. - enable more CI checks on more platforms. Turns out I just missed quite a few. - replace `test.sh` with `test.go`, which will be useful in uber#165
- run all tests on all platforms. - enable more CI checks on more platforms. Turns out I just missed quite a few. - replace `test.sh` with `test.go`, which will be useful in uber#165.
- run all tests on all platforms. - enable more CI checks on more platforms. Turns out I just missed quite a few. - replace `test.sh` with `test.go`, which will be useful in uber#165.
- run all tests on all platforms. - enable more CI checks on more platforms. Turns out I just missed quite a few. - replace `test.sh` with `test.go`, which will be useful in #165.
I landed #166, which opens up a path for you to add a WASI runner to https://github.com/uber/hermetic_cc_toolchain/blob/a5dcb8c486ecbbbbf82f70f189a35fe85a0a9810/test/c/c_test.go . Can you rebase and move your executor there? That way we will be able to test WASI on all platforms (via |
@motiejus updated - thanks! |
I would like to be able to compile wasm/wasi with zig + bazel. This adds a toolchain to be able to do so. Wasm/wasi is a pretty rapidly changing space, but I've choosen the most specific naming that I could (WASI preview 1). I've confirmed this works by running the compiled binary with wazero, a popular golang based wasm/wasi runtime in the tests. Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
Good callout. Done thanks! |
Thanks! |
I would like to be able to compile wasm/wasi with zig + bazel. This adds
a toolchain to be able to do so. Wasm/wasi is a pretty rapidly changing
space, but I've choosen the most specific naming that I could (WASI
preview 1).
I've confirmed this works by running the compiled binary with wasmtime,
a popular wasm/wasi runtime.