Stream: wasi

Topic: Trouble building mruby with wasi-sdk


view this post on Zulip YAMAMOTO Yuji (Sep 08 2021 at 10:59):

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.

Lightweight Ruby. Contribute to mruby/mruby development by creating an account on GitHub.
Lightweight Ruby. Contribute to mruby/mruby development by creating an account on GitHub.
Lightweight Ruby. Contribute to igrep/mruby development by creating an account on GitHub.
Now fails with `wasm-ld: error: entry symbol not defined (pass --no-entry to suppress): _start`

view this post on Zulip bjorn3 (Sep 08 2021 at 11:10):

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.

view this post on Zulip bjorn3 (Sep 08 2021 at 11:10):

@YAMAMOTO Yuji

view this post on Zulip YAMAMOTO Yuji (Sep 09 2021 at 02:37):

@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!

…ulip Building still fails. But thanks!

view this post on Zulip YAMAMOTO Yuji (Sep 10 2021 at 01:36):

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?

Lightweight Ruby. Contribute to igrep/mruby development by creating an account on GitHub.

view this post on Zulip YAMAMOTO Yuji (Sep 10 2021 at 02:09):

Ah, I found the way by myself: just to add libclang_rt.builtins-wasm32.
https://github.com/igrep/mruby/commit/5a791a68e041a2c8f7b018dc33a80d1f0d12c7e7

Lightweight Ruby. Contribute to igrep/mruby development by creating an account on GitHub.

Last updated: Dec 23 2024 at 13:07 UTC