-
Notifications
You must be signed in to change notification settings - Fork 849
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
How to get started #41
Comments
Hi, thanks for trying out wasmer! We're still putting the pieces together, so user-experience is a little rough right now, but it's improving fast! We don't have a good "hello, world" example, but that's a great idea! We also need documentation about how to compile c and c++ to run on wasmer. After seeing your question, we've gone and made it much simpler to run nginx:
and then navigate to http://localhost:8080/. In a way, this is a "hello, world", but we intend to make it even easier in the future :). Stay tuned for documentation on how to compile programs for wasmer within the next few days! |
Cool thanks. I just can't get this to run though: yshou-mint:~/wasmer-nginx-example$ wasmer run nginx.wasm -- -p . -c nginx.conf yshou-mint:~/wasmer-nginx-example$ wasmer --version |
I had a similar error when trying to run a hello world example. All tests for wasmer seem to run. test spectests::unwind::c35_l251_assert_trap ... ok test result: ok. 1439 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out aHello World Running target/debug/deps/wasmer-cdda729fbe30d952 If you have any debug tips let me know. |
I ran into this same issue on nightly Rust. Switching over to stable built a working binary. |
Facing similar issue as above. |
Related to #34 |
Hi (been offline for a while to respond to suggestions in this thread) ... what in this series of steps is being built by rust: $ curl https://get.wasmer.io -sSfL | sh # or run "wasmer self-update" if you already have it My rust toolchain version is default to stable: yshou-mint:~/wasmer-nginx-example$ rustup toolchain list But when I run the series of steps I still receive the same segmentation violation. I am not sure from the steps above what switching to stable is supposed to impact. I tried this a month ago around the time of my original post and again today after doing rustup update but the result is the same. I assume this is suppose to work ... any more suggestion on debugging? |
Hi @jlb6740, I have personally looked into the Linux issue and there are only a few things to fix before we get it working. It's mostly just macOS-specific stuff we added a while back. We should have it working soon. |
Hi @appcypher ... Ok thanks for the response. What is this new runtime that you refer to? Is this something that will make the current implementation in wasmer obsolete? Is there a chat or threads somewhere referencing this new effort? |
@jlb6740 The new runtime is currently progressing in this pull-request. Its purpose is to expose a traditional webassembly module/instance api to allow users to expose imports to the webassembly module similarly to how its done in the browser. Our emscripten implementation will be moved to depend on the new runtime. Most of the communication involving the new runtime has taken place internally, although, we expect it to be reasonably complete soon. Once complete, we will post about it. |
I am curious to learn wasm and the way I was thinking would be good is to write a toy compiler, written entirely in web assembly! I think this sounds like a fun project. It would be nice if wasmer had a simple guide that built on the webassembly by hand blog post but use wasmer instead of javascript to execute everything. In addition, some of the necessary components to make a toy compiler are:
Thoughts? |
@vitiral This is a fun idea. Wasmer supports all the necessary components you mentioned and several more! WebAssembly, by itself, cannot read/write or print to the user's machine. It needs APIs like Emscripten's to take advantage of it, which is what wasmer does currently. I was experimenting with a similar idea a while back (example/sys.wat) but we had to be pragmatic and focus on Emscripten. Once we finalize wasmer APIs, it will be possible to implement your own host environment and import that into a webassembly instance. I may even assemble a tutorial on how to do just that since I'm very interested in that as well. |
Closing this issue as the runtime is now much more mature since version It should be also very easy to create your own set of imports and embed the runtime as needed. Feel free to reopen the issue if you have extra questions or suggestions! |
Just today I ran into the same problem on Debian9
Strace:
|
Hi .. I am understanding CraneLift and related tools and I'm trying to use them to compile and run a standalone (no js or html needed) wasm programs. It is my understanding that CraneLift provides an IR and APIs for optimizing/manipulating WASM and generating executable code. This is what I want to understand. Since wasmer uses cranelift I thought this would be a good place to start to see an end-to-end process of executing WASM in a runtime. However, I am having trouble getting started. I've installed wasmer and am looking for a simple "helloworld" example that will print. The docs point me to a nginx.wasm file which I am not familiar with (google searches show it is some server code?) but when I run it I get this error message:
wasmer run nginx.wasm
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (1: Operation not permitted)
Runtime error: trap at 0x0 - segmentation violation
Since that error log doesn't exist I take it I should have installed something related to nginx first. Clearly this example is more complicated than what I am looking for right now. How should I get started with something straight forward. If I am starting with C and trying to simply print "Hello" compiling this code to WASM using emcc it is not clear to me how to properly create the C file (i.e., should it have a main? what flags do I use) to properly execute using wasmer. Any suggestions?
The text was updated successfully, but these errors were encountered: