-
Notifications
You must be signed in to change notification settings - Fork 952
WASI linker error: undefined symbol __multi3
#3501
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
Comments
We bundle compiler-rt for TinyGo. Normally it's as simple as this: --- a/targets/wasi.json
+++ b/targets/wasi.json
@@ -6,6 +6,7 @@
"goos": "linux",
"goarch": "arm",
"linker": "wasm-ld",
+ "rtlib": "compiler-rt",
"libc": "wasi-libc",
"scheduler": "asyncify",
"default-stack-size": 16384, ...but not this time, because wasm-ld needs a symbol table in the archive file and our archive creation code doesn't support that yet. So it needs some additions to builder/ar.go. |
Just hit this myself while testing:
|
Also just recently hit this bug. Not much context to be added compared to whats already here. Happened in a currently private repo. |
If someone would like to fix this bug, this is what needs to be done:
|
Closing since this is part of release 0.29.0 thanks! |
I ran into this linker issue when trying to build some Go code:
This happens with tinygo version 0.27.0, using the official container image. I can reproduce it also with tinygo built from the
dev
branch.Root cause
The
__multi3
symbol is provided by thelibclang_rt.builtins-wasm32.a
library, which, from what I understand, is not built by default bywasi-libc
.Quoting the official
README
:Each wasi-sdk release includes the pre-built library as one of its release artifacts.
Dirty workaround
Starting from the tinygo official container image, I added the
libclang_rt.builtins-wasm32.a
library provided by thewasi-sdk-16
release. This is the version of wasi-sdk used by tinygo 0.27.0.Then I patched the linker section of the
wasi.json
target to make use of this library:I couldn't find a way to avoid this change. I tried using different CGO environment variables, but none of them was being used.
Reproducer
I created this repository that contains:
Dockerfile
used to build the "patched" tinygo container imagewasi.json
target fileThe text was updated successfully, but these errors were encountered: