-
Notifications
You must be signed in to change notification settings - Fork 267
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
Build failure with Rust 1.82.0 and bundled wasm-opt #904
Comments
I investigated a few versions of I'm not sure how to make this happen when using trunk. So perhaps this is related to #866? |
It might make sense to update the default versions for the different tools: Lines 98 to 105 in 306fa0b
Also #901 might help. |
After some more experimentation, This problem seems specific to wasm-bindgen/wasm-bindgen-cli 0.2.95 (0.2.93 works; 0.2.94 was yanked but I think it's also broken). But the problem is only triggered by a build with rust 1.82.0. I don't think it matters what Trunk's default wasm-bindgen version is-- the version of |
I have the same problem
[parse exception: invalid code after misc prefix: 17 (at 0:564976)] rustc 1.82.0 (f6e511eec 2024-10-15) |
As you're using trunk 0.21.4, you should be able to use the new |
Or maybe we need to bump the default version of wasm-opt. |
Also note that this will be fixed in the next release of wasm-bindgen, which won't emit |
I had this issue and resolved it for myself with the following:
I admit I do not know what bulk memory or |
Thanks for the summary. That is super helpful. Now that we have internal APIs for the tools in place, would it make sense to auto-enable |
Note that rustc doesn't enable bulk memory by default, so to me the safest default would be to track whatever rustc is doing. Enabling bulk memory instructions by default could affect compatibility with existing runtimes. The reason we're having problems with rust 1.82.0 is because of a bug in wasm-bindgen 0.2.94-0.2.95: wasm-bindgen notices that rustc has enabled new target features, and accidentally enables bulk memory on its output as a side-effect. This will no longer be the case in wasm-bindgen 0.2.96. |
What should happen in the long term? A few possibilities I can think of:
Is Footnotes
|
Thanks for this thread! It's super helpful. Is it possible to specify default wasm-opt version through the configuration file? From a quick look at the documentation and code it appears not, but maybe I missed something. For others, this might be helpful: I managed to get things working by cloning the trunk, then patching trunk/src/tools.rs changing the default version to One thing I noted is |
I guess the answer to all of this is: PRs welcome 😉 |
@troelsfr the wasm-opt version is configurable already through Trunk.toml https://github.com/trunk-rs/trunk/blob/4c9d85f6f04a31a272c71db8df12e142c76311fb/Trunk.toml I'm using: [tools]
wasm_opt = "version_119" and this on my html: <link data-trunk rel="rust" data-bin="some-app-name" data-wasm-opt="z"
data-wasm-opt-params="--enable-bulk-memory" /> |
Sorry for not reading the docs careful enough! And thanks a lot for pointing me to the right place! |
It doesn't seem like this got fixed in the meantime, see our CI run in https://github.com/yewstack/yew/actions/runs/13441890205/job/37558138060. This hits the same issue with
Is there a way to set this |
That's surprising. I saw the problem go away when updating to wasm-bindgen 0.2.96, and since then we have also updated to 0.2.100 and the problem has not reappeared for us. I'm not sure what to look for in that github actions link; can you point out what the failure is? |
Example error for completeness (doesn't get marked as a build failure in the log for unrelated reasons - the relevant step is "Build examples"):
Maybe this got "revived" by 1.87.0-nightly? |
Yeah, looks like LLVM20 turned on bulk memory instructions: rust-lang/rust#137315 |
Should we consider always bundling the newest We can get the latest wasm_opt version using GitHub API by:
or if we want to do it in Rust (at runtime?): #[derive(Deserialize)]
struct GitHubRelease {
tag_name: String,
}
pub fn get_latest_wasm_opt_version() -> String {
let url = "https://api.github.com/repos/WebAssembly/binaryen/releases/latest";
let client = reqwest::blocking::Client::new();
// github api requires a user agent
// https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api?apiVersion=2022-11-28#user-agent-required
let req_builder = client.get(url).header("User-Agent", "trunk-wasm-opt-checker");
// Send the request
let res = req_builder
.send()
.expect("Failed to send request to GitHub API");
if !res.status().is_success() {
// Get more details about the error
let status = res.status();
let error_text = res
.text()
.unwrap_or_else(|_| "Could not read error response".to_string());
panic!(
"GitHub API request failed with status: {}. Details: {}",
status, error_text
);
}
let release: GitHubRelease = res.json().expect("Failed to parse GitHub API response");
release.tag_name
} |
After upgrading from Rust 1.81 to 1.82 I discovered that a particular wasm/trunk project no longer builds. It always fails with:
I built a minimized project that demonstrates the issue here: https://github.com/eric-seppanen/wasm_test_2024
This seems to be a wasm-opt issue, but since wasm-opt is bundled with trunk by default, perhaps it would be a good idea to ship a newer version?
The text was updated successfully, but these errors were encountered: