emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.62k stars 3.28k forks source link

Don't emit excess output files when targeting WebAssembly #4799

Closed juj closed 5 years ago

juj commented 7 years ago

When building e.g. em++ tests/hello_world.cpp -o a.html -s BINARYEN=1 -O3 -s BINARYEN_METHOD='native-wasm', two redundant files a.asm.js and a.wast are generated. It would be good to not output extra files that aren't needed.

1) I think we should always delete the file a.asm.js after build is done if BINARYEN_METHOD doesn't contain "asmjs", since if asmjs was not asked, the file a.asm.js is then of that "meta"-asm format and not functional?

2) The file a.wast should not get generated unless BINARYEN_METHOD contains "interpret-s-expr"?

Does that sound correct?

kripken commented 7 years ago

Correct. 1 is a cleanup we just need to do. 2 on the other hand is something we should not even emit when it wasn't asked for, which requires changes in binaryen to allow it to emit a binary directly. That will be much more efficient as well and improve compile times. Issue for that: https://github.com/WebAssembly/binaryen/issues/608

dschuff commented 7 years ago

Does emcc support the -save-temps flag or have some way to do the same thing? Probably these files would fall under that category (I agree we don't want to keep them in the usual case).

kripken commented 7 years ago

Yeah, we keep temp files around when EMCC_DEBUG is set in the env. Makes sense to do the same for these files.

juj commented 7 years ago

Alright, posted some cleanup lines.

gouletr commented 7 years ago

👍

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.