Need help with emscripten port


I think that the bootstrap is wrong in the section where it checks git submodules… When running the I was getting a message saying that src/bootstrap/ was panicking at line 536. Looks like the "*" on line 531 should be a "+". Anyone else seeing that?

I will take a stab at getting the ignore-emscripten tags in where they belong.


Should I fork @brson’s version and issue PRs against it? Is that the easiest?


Fork rust-lang/rust (just because it’s the upstream). But yes submit PR’s to my repo, emscripten-new branch.


I have not seen that, but the code does look wrong in the way you describe. Strange. You might submit a PR to rust-lang/rust for that.


Looks like someone already fixed it upstream.


@rschulman How is it going? On Friday it sounded like you had made quite some progress, discovering that rustbuild needed to be hacked up a bit for the std/core tests.

Do you mind submitting a PR for the progress you’ve already made?


@brson, happy to give you a PR with what is done so far.

Would you like me to give you two: one with the ignore-emscripten additions and one with whatever I have so far on fixing bootstrap?


Just a single PR is fine!


Alright. Will submit in a few.

I have new files in src/bootstrap/target which I assume are built by bootstrap and shouldn’t be included in the PR?


@rschulman Yes, that’s right. Usually that folder doesn’t exist, though perhaps it’s created if you run cargo directly in src/bootstrap.


I’ve merged @rschulman’s fixes to the test suite into my emscripten-new branch. Thanks @rschulman!

It sounds like there are still failing tests in stdtest, like those that spawn threads. These can similarly have cfg_attr(target_os = "emscripten", ignore) attributes. @rschulman is going to look into those as well, but doesn’t have a great deal of time this week.

Once --step check-target --target=asmjs-unknown-emscripten passes (with lots of ignored test cases if necessary) we can get PRs into rust-lang/rust. I’d like to do that by the end of this week, though friday/saturday is rustconf so it’s going to be difficult.


So I gave a talk yesterday at the Rust Cologne Meetup. Slides are online and I have some examples online as well.

With that out of the way, I now hopefully find some time to work on the remaining issues as well.


I’ve wanted to play with this, but have been struggling to get rust built. Thank you so much for providing the docker image!


I’ve pushed several commits to my emscripten-new branch. These improve testing support and add a wasm32-unknown-emscripten target that is sufficient to run wasm in node using the binaryen interpreter. This branch now requires a commit of libc from my fork as well as my fork of llvm.

I’m going to go ahead and submit PRs for all this stuff now and try to get it landed, while I continue to get the test suite to run cleanly for asmjs.


I’ve posted patches to libc and llvm.


I’ve opened another issue on the issue tracker to track progress of landing this work. The issue I was previously using is about mir2wasm, and I accidentally commandeered it temporarily to track this work.


So now my current emscripten-new branch seems to cleanly run the tests for asmjs-unknown-emscripten. The libc wasm32 patches are upstream. My next steps are to get the fastcomp patches merged, rebase brson/emscripten-new onto rust-lang/master, and post a PR to Rust.

In the meantime @rschulman is looking to get compiletest working with wasm32-unknown-emscripten. There’s a PR against emscripten to add some missing math intrinsics.

Additional work for people to pick up include:

  • Going through all the many failing asmjs-unknown-emscripten tests and seeing if any can be fixed. A lot of them seem like they relate to various options that may be configurable in emscripten (like resizable heaps, networking and filesystem support), and it’s not clear how or whether we should deal with them in-tree (I suspect they can be dealt-with as -C link-args and std doesn’t need to care, but maybe the test runner should be tweaked to change the emcc configuration. not sure; needs investigation).
  • Fixing unwinding. This is a deep problem and requires fixes in Rust and emscripten. Needs a hero.
  • Start coming up with mindblowing demos and libraries. An idea I had this morning was a project to collect a few production-ready javascript libraries written in Rust that web programmers can just download and use without dealing with the Rust side. Present it in a nice website that looks appealing to web devs like a real product.


I would like it if someone writes a opengl/webgl demo.


@jer are the Rust source files available for your examples ( If not, would it be possible to post them?


Here’s the patch to Rust.