mechanoid icon indicating copy to clipboard operation
mechanoid copied to clipboard

ld.lld: error: undefined hidden symbol: __math_invalidf

Open funkycode opened this issue 1 year ago • 5 comments

I built tinygo from source as per official documentation (on gentoo here) tried to run ping pong example on nicenano

$ sudo ~/go/bin/mecha flash -i wazero -m nicenano
Building TinyGo module ping
Done.
   code    data     bss |   flash     ram
      9       0       0 |       9       0
Application built. Now flashing...
ld.lld: error: undefined hidden symbol: __math_invalidf
>>> referenced by sf_sqrt.c:0 (/home/zogg/dev/tinygo/lib/picolibc/newlib/libm/math/sf_sqrt.c:0)
>>>               sf_sqrt.c.o:(sqrtf) in archive /root/.cache/tinygo/picolibc-thumbv7em-unknown-unknown-eabi-cortex-m4/lib.a
>>> did you mean: __math_invalid
>>> defined in: /root/.cache/tinygo/picolibc-thumbv7em-unknown-unknown-eabi-cortex-m4/lib.a(math_err_invalid)
failed to run tool: ld.lld
error: failed to link /tmp/tinygo2142027620/main: exit status 1
/usr/local/bin/tinygo flash -size short -stack-size 8kb -tags wazero -target nicenano -monitor .: exit status 1

btw i tried to do use only tinygo and wazero and get the same results

$ tinygo version                                                                                                                                                                                                          
tinygo version 0.31.2 linux/amd64 (using go version go1.22.2 and LLVM version 17.0.1)

funkycode avatar Apr 21 '24 11:04 funkycode

Hello @funkycode thanks for the report. I think this is actually related more to your TinyGo custom build than Mechanoid itself.

Can you flash the normal blinky1 program on your board?

tinygo flash -target nicenano examples/blinky1

Perhaps you can open an issue in the TinyGo repo to resolve. It might require some docs update for gentoo? Not sure on that one.

deadprogram avatar Apr 22 '24 09:04 deadprogram

Tinygo does work in general, but not with wazero/wasm host. Will open ticket there 🙏🏽

funkycode avatar Apr 22 '24 15:04 funkycode

please notice the wazero team currently is not actively maintaining support for this type of cross-build, we merely assisted the mechanoid team to upstream their patches ;)

evacchi avatar Apr 22 '24 16:04 evacchi

Sorry if I was unclear. I doubt it is anything specific to Wazero, rather is something to do with the custom TinyGo install. I meant to suggest opening issue in TinyGo repo, not Wazero repo.

deadprogram avatar Apr 22 '24 17:04 deadprogram

Also see https://github.com/tinygo-org/tinygo/issues/3530

deadprogram avatar Apr 22 '24 19:04 deadprogram