Need help with emscripten port


#84

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!


#85

I published an updated guide using @brson’s fixes here: https://gist.github.com/badboy/5b905e71cf41a83724da9f96ee14b5fe


#86

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

Looks like the usual suspects: external processes & packed structs


#87

@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?


#88

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


#89

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.


#90

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.


#91

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


#92

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


#93

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.


#94

Looks like someone already fixed it upstream.


#95

@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?


#96

@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?


#97

Just a single PR is fine!


#98

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?


#99

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


#100

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.


#101

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.


#102

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


#103

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 hello.rs 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.