Need help with emscripten port


When I look at asmjs-unknown-emscripten/rust-test-helpers/rust_test_helpers.o I see an ELF file, but I think it should be javascript.

Edit: I see the fix for this issue needs to go into gcc-rs. Will update a patch.


Here’s the patch to gcc-rs. Once that lands I rustbuild should pick it up and a lot of tests should start to pass.

Edit: Nope, I had to update the lockfile. I’ve done so and pushed a commit to update gcc-rs.


So now I’m going to focus again on ignore-emscriptening tests.


I’m trying to help out (or at least follow along here) but am having trouble getting the test command to build from the right LLVM commit. I’m not seeing where in @jer’s instructions he pulls in from LLVM, so I don’t know where to substitute your squashed commits, @brson.

I’m a compiler newbie but would love to help land rust -> wasm!


I published an updated guide using @brson’s fixes here:


Re-run with @brson’s gcc fixes:

Looks like the usual suspects: external processes & packed structs


@jer FYI I think you have an error in your setup gist, second to last line. There is no src/rust to run that python line in. I assume you mean /src/bootstrap/


Woops, yeah, I mean that. Fixed it in the gist


I’m afraid I accomplished little on emscripten yesterday. Let’s think more concretely about how to divide up the work. I’ve updated the wasm issue on the tracker with the tasks.

@jer is there anything particular you want to tackle? I’m thinking a good task for @rschulman would be to get make check working successfully, just add ignore-emscripten tags. @rschulman are you interested in doing that?

Run a single set of tests with a command like

python src/bootstrap/ --step check-rpass --target=asmjs-unknown-emscripten

The full set of test ‘steps’ is:

check-rpass check-rpass-full check-rpass-valgrind check-cfail check-cfail-full check-pfail check-rfail check-rfail-full check-pretty check-pretty-rpass check-pretty-rpass-full check-pretty-rfail check-pretty-rfail-full check-pretty-rpass-valgrind check-mir-opt check-codegen check-codegen-units check-incremental check-ui check-debug-info check-rustdoc check-docs check-rmake check-crate-rustc check-cargotest

Each of these can be run individually while sussing out the errors, then make check will do the full check. I’m not sure how some of these interact with the emscripten target.


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.