WebAssembly / wasi-sdk

WASI-enabled WebAssembly C/C++ toolchain
Apache License 2.0
1.29k stars 192 forks source link

input bytes aren't valid utf-8 #342

Open c-dvl opened 1 year ago

c-dvl commented 1 year ago

Hi,

I'm trying to build a wasm with wasi-sdk but encounter the following error on runtime step: failed to parse /home/celine/Documents/Rline/rline/examples/memory-limitation/target/test.wasm: input bytes aren't valid utf-8.

I don't have this error with emscripten compiler. As I have memory limit with this last I would like to try to compile it with wasi-sdk but this error appears.

Compiler command line /home/celine/Téléchargements/wasi-sdk-20.0/bin/clang++ src/main.cpp -o test.wasm

Runtime command line wasmtime test.wasm --invoke stress < input.json

Céline

abrown commented 1 year ago

Thanks for the report. Would it be possible to provide the code to reproduce this?

sunfishcode commented 1 year ago

@c-dvl Could you try running the file command on the wasm file, like this:

file /home/celine/Documents/Rline/rline/examples/memory-limitation/target/test.wasm

and posting the output here?

c-dvl commented 1 year ago

Hi,

@abrown :the cpp main file and the json one : test.zip

@sunfishcode : file target/test.wasm target/test.wasm: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=fd26e19b3e6379902de653665f1a71f8a20e6c15, for GNU/Linux 3.2.0, not stripped

sbc100 commented 1 year ago

Looks like something went wrong with your building system. target/test.wasm is an x86_64 executable, and presumably it is supposed to be a wasm file?