hybridgroup / mechanoid

Mechanoid is a framework for WebAssembly applications on embedded systems and IoT devices.
https://mechanoid.io
Apache License 2.0
169 stars 8 forks source link

ld.lld: error: undefined hidden symbol: __math_invalidf #30

Open funkycode opened 2 months ago

funkycode commented 2 months ago

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)
deadprogram commented 2 months ago

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.

funkycode commented 2 months ago

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

evacchi commented 2 months ago

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 ;)

deadprogram commented 2 months ago

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 commented 2 months ago

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