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: https://gist.github.com/badboy/5b905e71cf41a83724da9f96ee14b5fe

1 Like

Re-run with @brsonā€™s gcc fixes: https://gist.github.com/badboy/ead73d46e1f7e6f77d2ffcbd38cfdcd9

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/bootstrap.py?

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/bootstrap.py --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 bootstrap.py I was getting a message saying that src/bootstrap/lib.rs 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.