Conversation
|
Ping @jakelang |
|
@lrettig yo this PR is dead pretty much, I plan to migrate this stuff over to the readthedocs site. |
c2wasm.md
Outdated
|
|
||
| ## Install LLVM and Clang with the WASM backend | ||
|
|
||
| ### From the repo |
There was a problem hiding this comment.
Should offer the option to use the docker image we have.
|
I want to rewrite this. closing |
|
Please don't close. I'll cherry pick from it then. |
3e29617 to
0457722
Compare
|
Rebased on top of #132. |
| cd ../projects | ||
| git clone http://llvm.org/git/compiler-rt.git | ||
|
|
||
| Then initialize CMake: |
There was a problem hiding this comment.
Not sure why these two steps needs to be separate (initialise + build).
| - compiling to WebAssembly binary (`wasm-as`) | ||
| First we must compile C to LLVM bitcode through the Clang frontend: | ||
|
|
||
| Note: the last step can also be accomplished with [wabt](https://github.com/webassembly/wabt) (previously called *sexpr-wasm-prototype*). |
There was a problem hiding this comment.
actually the list of steps is gone and we need binaryen anyway for s2wasm
clang.md
Outdated
| s2wasm -o hello.wast hello.s | ||
| wasm-as -o hello.wasm hello.wast | ||
| ``` | ||
| Next we can generate linear WASM output from the bitcode: |
There was a problem hiding this comment.
The linear assembly format that WASM specifies
also i stopped maintaining this a while ago.
There was a problem hiding this comment.
The linear assembly format that WASM specifies
I'm also not sure what this means. Could you link to another doc that explains this?
|
Also needs to include a note about wasm-chisel (can copy it off the Rust PR) |
clang.md
Outdated
| `s2wasm -o main.wast main.s` | ||
|
|
||
| There you go, you have your very first WebAssembly binary. | ||
| The code will now be in WAST format but must be cleaned up with `ewasm-cleanup` to be deployed as a contract. |
There was a problem hiding this comment.
Refer to wasm-chisel instead of ewasm-cleanup.
|
|
|
|
||
| ## Install Binaryen | ||
|
|
||
| This one is much easier. Simply: |
There was a problem hiding this comment.
Could you link to the binaryen master install docs here? In case these steps change or something.
|
|
||
| ## Rolling your own compiler | ||
| Many high level languages already support compilation to WebAssembly | ||
| through the experimental LLVM backend. Unfortunately, it is a tedious |
There was a problem hiding this comment.
experimental LLVM backend
Could you please add a link to further documentation on this? Why is it "experimental"?
| ``` | ||
|
|
||
| ## Using this compiler | ||
| CMake will also generate an `install` target if you want to actually install Binaryen on your system. |
There was a problem hiding this comment.
How would you run this? cmake install? Could you please make that explicit here?
clang.md
Outdated
| `s2wasm -o main.wast main.s` | ||
|
|
||
| There you go, you have your very first WebAssembly binary. | ||
| The code will now be in WAST format but must be cleaned up with [wasm-chisel](https://github.com/wasmx/wasm-chisel) to be deployed as a contract. |
There was a problem hiding this comment.
must be cleaned up with wasm-chisel
Could you please make it explicit how to do this? Is it just a command you need to run? Do you need to clone the repo and compile and run? Etc.
clang.md
Outdated
| s2wasm -o hello.wast hello.s | ||
| wasm-as -o hello.wasm hello.wast | ||
| ``` | ||
| Next we can generate linear WASM output from the bitcode: |
There was a problem hiding this comment.
The linear assembly format that WASM specifies
I'm also not sure what this means. Could you link to another doc that explains this?
Closes #111.