bytecodealliance / lucet

Lucet, the Sandboxing WebAssembly Compiler.
Apache License 2.0
4.06k stars 165 forks source link

Hello World example fails #533

Closed michaelbjames closed 3 years ago

michaelbjames commented 4 years ago

I'm not sure if this is a documentation bug or an actual bug--I'm new to this project and can't quite figure that out.

I'm trying to run the hello world example from the docs, with the dockerfile from the docs, but on the object building phase I get the error:

root@da558b6501ef:~/hello# lucetc-wasi -o hello.so hello.wasm
Error: Lucet Module: Unknown module for symbol `wasi_unstable::fd_prestat_get

I expected this line to successfully complete and produce hello.so. It did not.

Steps to repro:

  1. Follow the compiling Lucet from scratch guide (with docker). For the rest of this, I'll be inside the docker image. Side note: to anyone else who encounters this, the dockerfile needs a CMD /bin/bash or something at the end, or else it won't run.
  2. cd /root/
  3. git clone https://github.com/bytecodealliance/lucet.git (Latest on master at time-of-filing is: 12ae2a0cec4a7726d5d023b9ac227af336c59e7d)
  4. git submodule update --init --recursive: Get all the submodules, as requested by the compiling for linux guide.
  5. make install: Build lucet
  6. source /opt/lucet/bin/setenv.sh: This is needed to put the tools below in $PATH
  7. mkdir /root/hello/ && cd /root/hello
  8. printf '#include <stdio.h>\nint main(void){ puts("Hello World"); return 0;}' > hello.c
  9. wasm32-wasi-clang -Ofast -o hello.wasm hello.c
  10. lucetc-wasi -o hello.so hello.wasm
  11. Error:
    ~/hello# lucetc-wasi -o hello.so hello.wasm
    Error: Lucet Module: Unknown module for symbol `wasi_unstable::fd_prestat_get

Let me know what other information might be helpful!

I would love to be just a documentation bug, so if there's some extra modules I need to put into my path I'd love to know what I need to do.

Thanks for taking the time to look at this!

fst-crenshaw commented 4 years ago

Thanks for submitting this issue. I appreciate your clear repro steps! After following your steps, I see exactly what you see:

$ wasm32-wasi-clang -Ofast -o hello.wasm hello.c
$ lucetc-wasi -o hello.so hello.wasm
Error: Lucet Module: Unknown module for symbol `wasi_unstable::fd_prestat_get

More to come.