Open hollowaykeanho opened 1 year ago
Issue confirmed caused by https://github.com/tinygo-org/tinygo/issues/3282 as TinyGo cannot see the assembly codes. Question answered. Further clarifications is in ticket 3282.
Which target is this? Because the math
package should be supported on all platforms (except AVR but that one has bigger problems).
amd64
. Command issued was tinygo test .
inside a string processing package.
EDIT:
By the way, don't pressure yourself. I just managed to developed the function successfully here: https://github.com/ZORALab/Hestia/commit/6f9f26c76c938f297f74e2ac0ef9a330f32fbd24
Still working on (and pathfinding) multi-arch package structuring for the repository. At the moment, I'm developing the Rust's Format
/ Go's Sprintf
function without reflection here: https://github.com/ZORALab/Hestia/tree/experimental/hestiaGO/hestiaSTRING
As far as from my side, it's considered completed and tested working. I just want to make sure both TinyGo and Go moving in the same direction. For what I know, embedded has a lot of asm codes (easier to develop as well). Already querying from Std team Go: https://groups.google.com/g/golang-nuts/c/_anP6F0iPDM
Cheers!
Can you try running tinygo test math
? It passes for me.
Also, please share tinygo version
.
Failed on my side:
u0:hestiaSTRING$ tinygo test math
tinygo:ld.lld: error: undefined symbol: log
>>> referenced by log.go:81 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/log.go:81)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Acosh)
>>> referenced by log.go:81 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/log.go:81)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Acosh)
>>> referenced by log.go:81 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/log.go:81)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Asinh)
>>> referenced 17 more times
tinygo:ld.lld: error: undefined symbol: exp
>>> referenced by exp.go:16 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/exp.go:16)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Erf)
>>> referenced by exp.go:16 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/exp.go:16)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Erf)
>>> referenced by exp.go:16 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/exp.go:16)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Exp)
>>> referenced 9 more times
tinygo:ld.lld: error: undefined symbol: exp2
>>> referenced by exp.go:142 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/exp.go:142)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Exp2)
tinygo:ld.lld: error: undefined symbol: floor
>>> referenced by floor.go:14 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/floor.go:14)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Gamma)
>>> referenced by floor.go:14 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/floor.go:14)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math.Lgamma)
>>> referenced by floor.go:14 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/floor.go:14)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math_test.TestFloor)
>>> referenced 1 more times
tinygo:ld.lld: error: undefined symbol: ceil
>>> referenced by floor.go:43 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/floor.go:43)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math_test.TestCeil)
>>> referenced by floor.go:43 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/floor.go:43)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math_test.TestCeil)
tinygo:ld.lld: error: undefined symbol: trunc
>>> referenced by floor.go:61 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/floor.go:61)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math_test.TestTrunc)
>>> referenced by floor.go:61 (/home/u0/Documents/zoralab/Hestia/.monteurFS/bin/golang/src/math/floor.go:61)
>>> /home/u0/.cache/tinygo/thinlto/llvmcache-2CEFCC256783054285B8EA72C5BF6AB1E037B087:(math_test.TestTrunc)
failed to run tool: ld.lld
error: failed to link /tmp/tinygo2492987438/main: exit status 1
FAIL
u0:hestiaSTRING$
Yeap, all above failure because tinygo can't see the .s
assembly source codes.
Version:
u0:hestiaSTRING$ tinygo version
tinygo version 0.26.0 linux/amd64 (using go version go1.19.1 and LLVM version 14.0.0)
I'm also getting an error running tinygo test math
on dev:
Strangely, the following commands seem to work:
$ GOOS=darwin tinygo test -c math
$ GOOS=windows tinygo test -c math
ld.lld-14: warning: duplicate /export option: hypot
ld.lld-14: warning: duplicate /export option: nextafter
Yeap, all above failure because tinygo can't see the
.s
assembly source codes.
Again, this is not the problem. It works fine on my side and in CI.
One thing you could try is running tinygo clean
. It might be that you have an old cache.
Other than that, you will need to provide some more steps to reproduce. How did you install TinyGo? What Linux distro are you on? Did you build from source or download the release tarball, or even install it from the distro package manager?
tinygo clean
did it for me :)
I'll leave my installation steps for posterity:
I followed the build-from-source steps shown on the site as of today. Since I am on linux mint I had to additionally do sudo apt install build-essential
for a cpp compiler and stuff. I also ran make llvm-source
. And with that I had a working tinygo installation.
tinygo clean
did it for me :)
Great! Then it's probably indeed just an old cache. (This is still technically a bug in TinyGo as it shouldn't use a stale cache, but it's not related to assembly files).
Noted. Should I retitle to reflect the latest finding?
Hi team! Is the following a bug?
While developing a TinyGo friendly standard library, I encountered these errors when attempting to re-use standard library's
math
package, which was marked usable and tested in the documentation (see screenshot below):Issue is not seen on standard Go compiler.
Site-note: No worries. I'm planning to adopt+modify standard library math package into my library that is friendly to TinyGo and Rust. The only disruption is schedule.