Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Errors while executing hello world example with lucetc-wasi #573

Closed
sergiizubchevskyy opened this issue Jul 30, 2020 · 5 comments
Closed

Comments

@sergiizubchevskyy
Copy link

sergiizubchevskyy commented Jul 30, 2020

Hello!

I've installed Lucet by following documentation here: https://bytecodealliance.github.io/lucet/Compiling-on-Linux.html, and opted for the first installation method.

After that I compiled hello world example using steps described here: https://bytecodealliance.github.io/lucet/Your-first-Lucet-application.html

After compiling hello.wasm file I execute it with Wasmtime (v 0.19.0) and it prints "Hello World" as expected.

However after generating hello.so file and attempting to execute it with lucetc-wasi command I'm getting errors like: unexpected char, unexpected EOF, unexpected token etc.

Example:
1:
image

2:
image

3:
image

Also, I might be going the wrong path here but I'm attempting to use Lucet to produce some sort of AOT file that will skip the compilation performed by Wasmtime. I assumed that Wasmtime should be able to consume hello.so, however this is not the case, it outputs the following:
image

Could you point me in the right directions here? Am I understanding correctly the Lucet's usage?

Thank you in advance.

@jedisct1
Copy link
Contributor

Hi!

lucetc-wasi is the compiler. It cannot run code.

The resulting .so (or .dylib) file must be run with lucet-wasi, which is a different tool.

@sergiizubchevskyy
Copy link
Author

Wow! Thank you for such a fast answer! I'm reinstalling the Lucet so will try as soon as it is installed.

And what about the Wasmtime? Is there a way to pass compiled .so object or similar to avoid compilation by JIT compiler of Wasmtime?

@sergiizubchevskyy
Copy link
Author

sergiizubchevskyy commented Jul 30, 2020

You're correct, invoking the lucet-wasi tool solves the issue with errors.

From what I read in the meantime, I've got an impression that there is no way (at least for now) to use some sort of AOT with the Wasmtime, and I had am impression that Wasmtime is the runtime used by Lucet but after searching I think Wasmtime is used to provide some files for build support.

@jedisct1
Copy link
Contributor

Wasmtime includes a cache: https://bytecodealliance.github.io/wasmtime/cli-cache.html - Once code has been cached, it doesn’t need to be recompiled any more.

@sergiizubchevskyy
Copy link
Author

Thank you!

I've done some tests and according to Valgrind Massif and got a bit surprised since consecutive executions with cache enabled still got almost 4MiB, when comparing with Wasmtime JIT (cache disabled) 4.4MiB... It is improvement, but not as much as I was expecting.

Check this out:
1st cache enabled execution:
image

2nd cache enabled execution:
image

3rd cache enabled execution:
image

And now Wasmtime, cache disabled:
image

But this is way beyond Lucet's responsibility!

Thank you again jedisct1! You really helped me a lot.

I think this issue can be closed, you prefer me to close it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants