-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
worker.js file should be placed into the output directory when targeting Emscripten with pthread support #13720
Comments
Thanks for the report! Could you share some more specifications and documentations of that output behavior of emscripten? I found one here, but not sure if it always does that. |
BTW, are there any more files for emscripten that we want to uplift to the target directory? |
Hi @weihanglo Thanks for a quick response! In the Special Considerations section it mentions that the
In addition,
Emscripten choses what to emit based on a suffix of the output file:
Additional files
Yes indeed. Those files are: Cheers |
Hey. Sorry for the delayed response. The Cargo team discussed this during today's meeting. The general idea here is that we are okay for adding Just note that, due to the fact that In a better future, we'd like to see rustc informing Cargo about the files it emits, so that Cargo doesn't need to hard-code all of them. Thank you. |
A general note for the future, keep in mind of this PR that recently was merged in Emscripten. With the master branch Emcscripten, // This file is no longer used by emscripten and has been created as a placeholder
// to allow build systems to transition away from depending on it.
//
// Future versions of emscripten will likely stop generating this file at all. |
Thanks @charmitro for the updated info! Given |
I generally agree. However, is there a way to check which version is installed and, based on that, generate *.worker.js, at least until Emscripten completely removes this feature? |
To me, I won't bother that. Emscripten is not a tier 1 platform and user can always download the latest version of it. The maintenance cost might not be worthy for a deprecated-soon-removed feature. And we don't have proper CI infra to test that. Also, I don't think there is a safe and stable way to get the version info. Invoking emscripnt is probably the straightforward one, and Cargo should invoke external binaries as less as possible. |
Makes sense, you're right. I completely agree with not moving forward with this. |
Hi What a timing of the emscripten change! Thanks @charmitro for digging it up. I think we an close the issue 👍 Cheers |
Problem
When targeting
wasm32-unknown-emscripten
with Pthread support, the*.worker.js
file is not copied to the output directory from thedeps
folder, even though the Emscripten compiler generates that file. Theworker.js
is required by multithreaded wasm apps and is a mandatory output artefact.Steps
Expected output:
Actual output:
Note that
issue.worker.js
is missing in the output directory. However, it is successfully created by the compiler and can be found in thedeps
folder:Possible Solution(s)
A solution would be to adjust the list of file types returned by
file_types()
for wasm32 target to include*.worker.js
:cargo/src/cargo/core/compiler/build_context/target_info.rs
Line 405 in 5da2858
Notes
No response
Version
The text was updated successfully, but these errors were encountered: