You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wasm-validator errors when trying to compile rust-brotli to wasm32 #42518
Here are the logs(sorry, these are to big for gist and also Git doesn't want to accept the archive in this issue) for cargo +nightly build --target=wasm32-unknown-emscripten --verbose:
Some libc definitions are wrong for emscripten target, see rust-lang/libc#610.
Here is a small example that fails to compile:
use std::fs::File;use std::io::{Seek,SeekFrom};fnmain(){letmut f = File::open("x.txt").unwrap();
f.set_len(5).unwrap();
f.seek(SeekFrom::Start(2)).unwrap();}
It works for asmjs (I think because there is no validation), but fails for wasm32. The error is:
[wasm-validator error in function $__ZN3std2fs4File7set_len17h668c1fb11d26e7feE] 2 != 1: call param types must match, on
[i32] (call $_ftruncate
[i32] (get_local $3)
[i64] (get_local $2)
)
[wasm-validator error in function $__ZN47__LT_std__fs__File_u20_as_u20_std__io__Seek_GT_4seek17h53361e7da9834951E] 2 != 1: call param types must match, on
[i32] (call $_lseek
[i32] (get_local $5
[i64] (get_local $22)
[i32] (get_local $24)
)
The problem is that off_tshould bei32 but wasi64. Although the libc patch are tested against asmjs, I think that it will work for wasm32.
After the libc PR get merged, it is necessary to update libc in rust. Well, I hope this assertions are correct, after all, the tests are green.
Reacted by Lilian Anatolie Moraru, Sergey Rubanov and Sergei Shulepov
Activity
malbarbo commentedon Jun 9, 2017
Some libc definitions are wrong for emscripten target, see rust-lang/libc#610.
Here is a small example that fails to compile:
It works for asmjs (I think because there is no validation), but fails for wasm32. The error is:
The problem is that
off_tshould bei32but wasi64. Although the libc patch are tested against asmjs, I think that it will work for wasm32.After the libc PR get merged, it is necessary to update libc in rust. Well, I hope this assertions are correct, after all, the tests are green.
lilianmoraru commentedon Sep 6, 2017
Still doesn't compile on nightly :(
Even with
--features no-stdlibEnselic commentedon Sep 21, 2023
Triage: Is this still a problem 6 years later? (If it would be easy to check I would check myself, but doesn't seem easy to check.)
Enselic commentedon Apr 18, 2024
Triage: Assuming not a problem any longer. Closing.