wasmer icon indicating copy to clipboard operation
wasmer copied to clipboard

New cmdline option `wasmer create-exe --self-test`

Open NobodyXu opened this issue 2 years ago • 6 comments

Motivation

wasmer create-exe requires WASMER_DIR to be set to the location of the Wasmer installation and it also requires at least compiler cc and linker ld to be present.

In case where cross compilation is required, it would also need zig-cc to be present.

Proposed solution

I want to use wasm create-exe in https://github.com/cargo-bins/cargo-binstall/issues/246 and having wasm create-exe --self-test that returns 0 on success would perfectly fix this issue, not only for cargo-binstall but also for other scripting usage of wasm create-exe.

Alternatives

We can use wasm create-exe to compile a simple hello-world wasi program to verify that it is usable, but that requires a simple hello-world wasi to be embedded in the program and compiling this program might also take a lot of computation resource and make the program sluggish.

Additional context

This feature request is first mentioned in https://github.com/wasmerio/wasmer/issues/3053#issuecomment-1210736435

NobodyXu avatar Aug 11 '22 02:08 NobodyXu

Errors are thrown if some component needed for create-exe is missing, to make this scriptable we can assign exit code numbers for each kind of error so that it can be part of an automated system.

So running wasmer create-exe with no argument will also gives error if something is missing?

NobodyXu avatar Aug 16 '22 13:08 NobodyXu

@epilys So we still need "--self-test", but that won't be hard because wasmer already throw errors on missing components?

NobodyXu avatar Aug 17 '22 04:08 NobodyXu

If we have wasmer create-exe properly running and returning successful errors, I'm not sure we'll need --self-test. Perhaps we need to add more extra tests into our CI

syrusakbary avatar Sep 06 '22 15:09 syrusakbary

If we have wasmer create-exe properly running and returning successful errors, I'm not sure we'll need --self-test.

I propose --self-test because I don't want to compile a hello-world program just to figure out whether the host can run wasmer create-exe or not.

NobodyXu avatar Sep 07 '22 02:09 NobodyXu

Okay, thanks @NobodyXu, we weren't sure what the motivation for this issue was. I'll discuss it further with @syrusakbary, we will get back to you.

fschutt avatar Sep 07 '22 09:09 fschutt

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 03 '24 21:05 stale[bot]

Feel free to reopen the issue if it has been closed by mistake.

stale[bot] avatar Jun 05 '24 01:06 stale[bot]