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

wasmer create-exe failed becauase "wasmer.h" not found #3053

Closed
NobodyXu opened this issue Jul 30, 2022 · 4 comments
Closed

wasmer create-exe failed becauase "wasmer.h" not found #3053

NobodyXu opened this issue Jul 30, 2022 · 4 comments
Labels
bug Something isn't working priority-low Low priority issue
Milestone

Comments

@NobodyXu
Copy link
Contributor

NobodyXu commented Jul 30, 2022

Describe the bug

I installed wasmer using:

cargo install wasmer-cli --features singlepass,cranelift,llvm

And then wasmer create-exe failed.

Steps to reproduce

For example,

  1. cargo install wasmer-cli --features singlepass,cranelift,llvm
  2. cargo new hello-world
  3. rustup target install wasm32-wasi
  4. cd hello-world && cargo build --release --target wasm32-wasi
  5. wasmer create-exe hello-world/target/wasm32-wasi/release/hello-world.wasm -o hello-world

Actual behavior

error: Failed to compile C source code
╰─▶ 1: C code compile failed with: stdout: 
       
       stderr: wasmer_main.c:1:10: fatal error: wasmer.h: No such file or directory
           1 | #include "wasmer.h"
             |          ^~~~~~~~~~
       compilation terminated.
       

System information

wasmer 2.3.0
Linux 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
@NobodyXu NobodyXu added the bug Something isn't working label Jul 30, 2022
@epilys epilys added the priority-low Low priority issue label Aug 2, 2022
@epilys epilys added this to the v3.0 milestone Aug 2, 2022
@NobodyXu
Copy link
Contributor Author

NobodyXu commented Aug 2, 2022

I don't know if/where it exists in the documentation, but environment variable WASMER_DIR must point to your wasmer installation. Since you installed it with cargo, it's not going to be there. You can download the tarball from the releases and take the files from there and put it in any directory (for example /home/user/.local/share/wasmer/) then export WASMER_DIR=/home/user/.local/share/wasmer/

Can we have that documented in wasm create-exe --help?

Also, does that mean we need to have a c compiler, linker and ar?

@NobodyXu
Copy link
Contributor Author

NobodyXu commented Aug 2, 2022

Thanks!

I'm looking forward to the 3.0.0 release!

@epilys epilys closed this as completed Aug 2, 2022
@NobodyXu
Copy link
Contributor Author

I just saw the new blog post and it's good to see wasmer moving forward.

Though after checking the doc again, I still was not able to find the documentation for exactly what is needed for wasmer create-exe.

@epilys Is it feasible to improve a new API like wasmer create-exe --self-test that returns 0 if the env required for create-exe is set-up and ready-to-go, otherwise return a non-zero code?

I was thinking about fetching wasi and compile it to native executable in cargo-binstall cargo-bins/cargo-binstall#246 but I need some way to reliable determine if wasmer create-exe would work or not.

Using wasmer create-exe to compile a sample hello-world program would definitely work, but I afraid that would waste a lot of resource for nothing and it is better for wasmer itself to support for a efficient --self-test so that cargo-binstall and other tools can reliably use it to determine if that create-exe is usable.

If --self-test is possible, I'd also like a --quiet flag to disable stderr/stdout.

@NobodyXu
Copy link
Contributor Author

@epilys I've submit a new feature request #3092.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-low Low priority issue
Projects
None yet
Development

No branches or pull requests

2 participants