wasmer: Error while importing "env"."system": unknown import. Expected Function(FunctionType { params: [I32], results: [I32] })
Summary
Hi, I’m wondering what I need to know in order to understand and work on a fix to move past this error message please?
# emcc *.c -o metamath.wasm
# wasmer metamath.wasm
error: failed to run `metamath.wasm`
╰─> 1: Error while importing "env"."system": unknown import. Expected Function(FunctionType { params: [I32], results: [I32] })
Additional details
And here’s the containerised build environment I’m currently using (happy to take alternative suggestions for this)
Dockerfile
FROM emscripten/emsdk:1.40.1
WORKDIR /app
# Get wasmer
RUN curl https://get.wasmer.io -sSfL | sh
ENV PATH="/root/.wasmer/bin:${PATH}"
# Get the metamath source code
RUN curl http://us.metamath.org/downloads/metamath.zip -o metamath.zip
RUN unzip metamath.zip -d .
# For convenience also get set.mm
RUN curl https://raw.githubusercontent.com/metamath/set.mm/develop/set.mm -o set.mm
# And when run, launch the shell
WORKDIR /app/metamath
CMD ["sh"]
usage:
docker build -t metamath .
docker run -it metamath
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (10 by maintainers)
Commits related to this issue
- Move `ALLOW_MEMORY_GROWTH` to the WASM test. This requires us to export a `emscripten_notify_memory_growth(…)` stub a workaround from https://github.com/wasmerio/wasmer/issues/2589 — committed to cubing/twsearch by lgarron a year ago
- Move `ALLOW_MEMORY_GROWTH` to the common WASM flags. This requires us to export a `emscripten_notify_memory_growth(…)` stub a workaround from https://github.com/wasmerio/wasmer/issues/2589 — committed to cubing/twsearch by lgarron a year ago
Ah, #1640 suggests 1.38.43 or earlier, but 1.39.0 is as far back as the emscripten/emsdk containers go on dockerhub.
Guess I’ll have to find a different container or learn how to install the full development environment myself after all.
Thanks for your help! 😃
Yes, that’s impressive work! Well done, and thank you! 😃
Um, because Metamath is a command line program and wasmer is for command line programs, and I’m spoilt by nodejs, and thus used to command line JavaScript being almost the same as web JavaScript. Wouldn’t have been such a terrible idea if the WASI support was complete consistently across the board, would it? Not so smart in hindsight, sorry. Even now I’m not sure I appreciate the finer points in terms of the distinction between wasmer, @wasmer/cli, and @wasmer/wasm-terminal.
Hmm. I seem to be able to curl set.mm fine.
Weird, works fine for me.
Ah, now that you say it, that’s what
ALLOW_MEMORY_GROWTHis for.So does
😃 (Though of course this means running untrusted unsandboxed binaries on your system, so I’m not sure it’s all that terribly useful.)
I sure would have liked it if I could use
--embed-fileto addset.mmand friends into the wasm binary (they’re 40 MB without comments, but it’s generally expected that you need to compress wasm before network transfers, as does wapm, so that’s ~ok.), but that doesn’t seem to work.Should probably start
FROMsomething that’s notemscripten/emsdkto avoid version confusion.This gets me to the metamath prompt, but trying to read set.mm fails for different reasons. Good luck with that. ;P
Same Problem