tinygo icon indicating copy to clipboard operation
tinygo copied to clipboard

Tinygo build. But lots of package undefined.

Open msxfXF opened this issue 1 year ago • 2 comments
trafficstars

Version

tinygo version 0.30.0 darwin/amd64 (using go version go1.21.4 and LLVM version 16.0.1)

Source code

package main

func main() {
	println("hello world!")
}

Build

tinygo build -target cortex-m0

Output

# runtime
/opt/homebrew/Cellar/tinygo/0.30.0/src/runtime/scheduler.go:30:21: undefined: timeUnit
/opt/homebrew/Cellar/tinygo/0.30.0/src/runtime/scheduler.go:84:42: undefined: timeUnit
/opt/homebrew/Cellar/tinygo/0.30.0/src/runtime/time.go:11:33: undefined: timeUnit
/opt/homebrew/Cellar/tinygo/0.30.0/src/runtime/baremetal.go:59:2: undefined: putchar
...
/opt/homebrew/Cellar/tinygo/0.30.0/src/runtime/time.go:12:9: undefined: nanosecondsToTicks

But when I change target to arduino. Compile normally. I want to know what steps I overlooked? Or is the file missing?

msxfXF avatar Jan 10 '24 08:01 msxfXF

Hello @msxfXF the target -target cortex-m0 is not specific enough to build. You need to use the specific target that matches your actual board. For example:

tinygo build -target arduino-nano33 ./path/to/your/code

The target named cortex-m0 is used as a dependency for boards that use a processor based on m0 to avoid duplication in the .json files that describe the various targets.

Hope that helps explain.

deadprogram avatar Jan 13 '24 08:01 deadprogram

This has greatly helped me, thank you very much!

---Original--- From: "Ron @.> Date: Sat, Jan 13, 2024 16:02 PM To: @.>; Cc: "Haofei @.@.>; Subject: Re: [tinygo-org/tinygo] Tinygo build. But lots of package undefined.(Issue #4080)

Hello @msxfXF the target -target cortex-m0 is not specific enough to build. You need to use the specific target that matches your actual board. For example:

tinygo build -target arduino-nano33 ./path/to/your/code

The target named cortex-m0 is used as a dependency for boards that use a processor based on m0 to avoid duplication in the .json files that describe the various targets.

Hope that helps explain.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

msxfXF avatar Jan 13 '24 08:01 msxfXF

Looks like the issue has been solved, so closing.

aykevl avatar Feb 25 '24 14:02 aykevl