math32 icon indicating copy to clipboard operation
math32 copied to clipboard

Importing math32 for TinyGo on RP2040/arm32 missing methods for Sqrt Log and Exp

Open djthorpe opened this issue 3 years ago • 1 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)
}

djthorpe avatar May 28 '22 10:05 djthorpe

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!

soypat avatar Jul 17 '22 05:07 soypat

Fixed in latest version v1.11.0- the Go tool was not picking up v1.11 tag because it was missing the minor version to qualify as semantic versioning. Running go get -u gihub.com/chewxy/math32@latest in a project should bring it this latest version.

soypat avatar Aug 19 '24 03:08 soypat