Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emscripten support broken by cargo file layout changes #4087

Open
CryZe opened this issue May 22, 2017 · 2 comments
Open

emscripten support broken by cargo file layout changes #4087

CryZe opened this issue May 22, 2017 · 2 comments
Labels
A-layout Area: target output directory layout, naming, and organization C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-build S-triage Status: This issue is waiting on initial triage.

Comments

@CryZe
Copy link

CryZe commented May 22, 2017

Moved over from: rust-lang/rust#38454

Looks like the compiler uses hashes as postfixes for the deps now. This messes with emscripten though, as the final "binaries" don't get copied out of the deps folder correctly anymore. Also the original names get baked into the JS files, so even if copied out correctly, they can't find each other anymore.

Uncaught could not load memory initializer aoc-66434e595ec0b4e8.js.mem

To clarify, the final JS binary is located in the target/asmjs-unknown-emscripten/release/ folder as aoc.js like intended. However there's no aoc.js.mem file like there used to be. That's because the deps are called aoc-66434e595ec0b4e8 now, so the compiler spits out the binaries with that name. However rustc only copies out the aoc-66434e595ec0b4e8.js as aoc.js, but not the mem file. But even if it copied out the mem file, it wouldn't be able to rename it, because the aoc.js looks specifically for the original name.

@CryZe
Copy link
Author

CryZe commented May 22, 2017

Recently there has been a fix for .lib files on Windows (afaik) which were affected by this too, so a similar fix could be applied for this.

@alexcrichton
Copy link
Member

Thanks for the report! The relevant code in Cargo is here, which specifically avoids passing -C extra-filename=... for some file types (dylibs and cdylibs). This means that the long hash at the end (-66434e595ec0b4e8 above) won't get thrown into the filename.

Even with that, though, the aoc.js.mem file still will not be present in target/asmjs-unknown-emscripten/release but rather inside .../release/deps. Cargo manually lifts files up from the deps folder to the ../release folder and it doesn't know about the *.mem files because rustc itself doesn't know about the mem files!

Is that a suitable solution here? Or is it also required to lift up the *.mem file as well?

@carols10cents carols10cents added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-build labels Oct 3, 2017
@epage epage added A-layout Area: target output directory layout, naming, and organization S-triage Status: This issue is waiting on initial triage. labels Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-layout Area: target output directory layout, naming, and organization C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-build S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

4 participants