Is anyone experiencing this or am I having something broken on my setup? https://github.com/rust-lang/rust/issues/73278
@Alexandru Ene does the same issue happen with other runtimes? or just WAMR?
Yes, any runtime has that issue, as basically the generated wasm binary doesn't import the things it should import for File::open() to work.
If I build it on OSX fd_prestat_get
and another method is missing from the imports list (same build with wasm32-wasi
as a target. On windows it generates the correct thing. I didn't try linux as I didn't have a machine, but it looks like cargo build --target wasm32-wasi
generates different things on windows/osx at least.
My follow-up comment has some more things I uncovered as I was debugging this.
hm so the platform differences are unexpected, but I'm otherwise a bit confused as to what the issue is
is file opening not working or is it just pulling in unexpected imports?
No, so the generated file doesn't have the imports that it needs to have when building on OSX (the broken version). When building on windows, it imports as expected fd_prestat_get
for the wasm32-wasi target
I don't think the platforms should generate different binaries, at least not with regards to the WASI-related imports
so only if you compile the program from macos does the wasm not work?
Yup
Compiling the same exact code with the same compiler version on windows does work and generate the code that has the correct import fields on windows but not osx
ok I'll try to dig in
Yeah if you have these in the generated .wasm
then it means that it correctly compiled .
(import "wasi_snapshot_preview1" "fd_prestat_get" (func $__wasi_fd_prestat_get (type $t2)))
(import "wasi_snapshot_preview1" "fd_prestat_dir_name" (func $__wasi_fd_prestat_dir_name (type $t8)))
that program works for me when compiled from macos/linux/windows
all three platforms produce the same exact wasm file byte-for-byte
so I can't reproduce?
:frown: I did suspect something's strange on my setup then
Might as well close the issue I think if nobody else can repro it
Thanks for the help and test @Alex Crichton
Last updated: Nov 22 2024 at 16:03 UTC