I'm trying to build mruby with wasi-sdk. After forking from its ver. 3.0.0, I created a build config to build a minimal version of mruby command with wasi-sdk, then deleted several lines of code depending on non-WASI APIs. But I still got an error by wasm-ld
:
wasm-ld: error: entry symbol not defined (pass --no-entry to suppress): _start
Now I'm completely unsure of the cause and how to fix. Does anyone know?
Here is the details:
See also: Guide to build mruby https://github.com/mruby/mruby/blob/3.0.0/doc/guides/compile.md
Thanks in advance.
You aren't passing wasi-libc and the crt to the linker. Does the mruby build system allow you to use clang as driver instead of directly calling wasm-ld? If so you should likely prefer this. If not you will need to pass -lc
and I think #{WASI_SDK_ROOT}/share/wasi-sysroot/lib/wasm32-wasi/crt0.wasm
to wasm-ld.
@YAMAMOTO Yuji
@bjorn3 Thanks for a quick reply! This change after your advice fixed the error. I've got another errors which look caused by lack of the exception library. So I'll make up some way to avoid. Thanks again!
After disabling C++ exception with this commit, I got more "undefined symbol" error by wasm-ld:
wasm-ld: error: /opt/wasi-sdk-12.0//share/wasi-sysroot/lib/wasm32-wasi/libc.a(pselect.o): undefined symbol: __muloti4
wasm-ld: error: /opt/wasi-sdk-12.0//share/wasi-sysroot/lib/wasm32-wasi/libc.a(intscan.o): undefined symbol: __multi3
How can I tell wasm-ld about those built-in functions such as __multi3
?
Ah, I found the way by myself: just to add libclang_rt.builtins-wasm32.
https://github.com/igrep/mruby/commit/5a791a68e041a2c8f7b018dc33a80d1f0d12c7e7
Last updated: Nov 22 2024 at 16:03 UTC