[rust-dev] enscripten demo?

Brian Anderson banderson at mozilla.com
Mon Apr 9 13:00:04 PDT 2012

On 04/04/2012 02:55 AM, Mohd. Bilal Husain wrote:
> Passed a dumb sample rust bitcode to emscripten, got js functions#. 
> Realized I need to run on core modules too for printing simple hello 
> world. Took io from libcore, decimated code to avoid few build errors, 
> emcc throws error
>     Unclear type in struct
> Anyways, need to figure out how to build native modules and core lib, 
> std lib; and how to map these modules to imports in a sample hello-world.

I did some tinkering this weekend and found the following:

* Rust code needs to be compiled for 32-bit targets. Emscripten is not 
heavily tested for 64-bit targets.
* rustc should be invoked with --no-asm-comments because emscripten does 
not like asm
* We were generating some bogus ll asm, fixed by #2167
* Emscripten doesn't handle quoted labels, fixed in my branch: 
* Emscripten doesn't handle the `frem` instruction, also in my branch
* Emscripten doesn't handle empty structs in some situations, filed 
here: https://github.com/kripken/emscripten/issues/364

More information about the Rust-dev mailing list