Skip to content
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

wasm-interp --enable-exceptions error invalid import "env.saveSetjmp" #2455

Open
calvin2021y opened this issue Aug 22, 2024 · 8 comments
Open

Comments

@calvin2021y
Copy link

calvin2021y commented Aug 22, 2024

wasm-interp --enable-exceptions test

error initializing module: invalid import "env.saveSetjmp"
@SoniEx2
Copy link
Contributor

SoniEx2 commented Aug 22, 2024

it looks like you're trying to run an emscripten module. wabt is only a wasm engine, not a full wasm runtime, and definitely not an emscripten runtime. however, if you can get a pure-wasi module instead, you can try compiling wabt with wasi support.

@calvin2021y
Copy link
Author

calvin2021y commented Aug 22, 2024

I use WASI sdk with --target=wasm32-wasi -mllvm -wasm-enable-sjlj, not emscripten.

@SoniEx2
Copy link
Contributor

SoniEx2 commented Aug 22, 2024

oh, in that case, you may be missing wasi-libc?

@calvin2021y
Copy link
Author

do you mean link step or runtime step?

I static link with wasi-libc libc.a

@SoniEx2
Copy link
Contributor

SoniEx2 commented Aug 22, 2024

it's trying to import stuff that's not provided by wasi. check wasm-objdump.

@calvin2021y
Copy link
Author

It use setjmp provide by wasi.

is wasm-interp support setjmp?

@SoniEx2
Copy link
Contributor

SoniEx2 commented Aug 22, 2024

wasi doesn't provide setjmp

@sbc100
Copy link
Member

sbc100 commented Aug 22, 2024

saveSetjmp is the name of a function that LLVM used to call prior to llvm/llvm-project#84137.

Starting with LLVM 19 you should see __wasm_setjmp and __wasm_setjmp_test instead.

Support for these symbols was added to wasi-libc in WebAssembly/wasi-libc#483 which is part of wasi-sdk-22, but it looks like there is no version of wasi-sdk yet that includes LLVM 19, so there is not yet an official version of wasi-sdk that supports sjlj. I think this is because LLVM 19 has not yet actually been released.

Anyway, none of this has anything to do with wabt.. so I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants