Importing math32 for TinyGo on RP2040/arm32 missing methods for Sqrt Log and Exp
djthorpe opened this issue · comments
I am importing your great float32 package for the following environment:
tinygo version 0.23.0 linux/arm (using go version go1.18.1 and LLVM version 14.0.0)
Target: Raspberry Pi Pico RP2040 (arm32)
Linking is failing as per message below.
tinygo:ld.lld: error: undefined symbol: github.com/chewxy/math32.Sqrt
tinygo:ld.lld: error: undefined symbol: github.com/chewxy/math32.Log
tinygo:ld.lld: error: undefined symbol: github.com/chewxy/math32.Exp
I think this is because some sort of architechture nuance here means it does or doesn't have the in-built architecture dependent versions. Sorry not sure of the exact flags, happy to help debug some more.
The workaround for me is to comment out missing "haveArchExp" symbol (for example):
func Exp(x float32) float32 {
/* if haveArchExp {
return archExp(x)
}*/
return exp(x)
}
Hey sorry for the long wait, not sure how this slipped my radar. I've added a fix to exclude all assembly from tinygo builds. Let me know if this solves your issue!