tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
15.48k stars 913 forks source link

Failing build on Raspberry Pi 4 #4463

Closed ShDDaniel closed 2 months ago

ShDDaniel commented 2 months ago

Hello!

Raspberry Pi 4 Model B Rev 1.4 tinygo version 0.33.0 linux/arm64 (using go version go1.23.0 and LLVM version 18.1.2)

package main

import (
    "machine"
)

func main() {
    machine.I2C0.Configure(machine.I2CConfig{})
}

running tinygo build yields /usr/local/lib/tinygo/src/machine/machine_generic.go:145: linker could not find symbol __tinygo_i2c_configure, yet build with a target succeeds, e.g : tinygo build -target=pico

aykevl commented 2 months ago

The machine package is not supported on Linux, that's why you see that error. So you can't use it to interact with I2C on the Raspberry Pi 4 if that's what you want.

I agree the error could be much better though.

ShDDaniel commented 2 months ago

Oh, that was unexpected. Indeed I wanted to use I2C on Raspberry Pi. Is it possible that package will be supported in the future on Linux?

dgryski commented 2 months ago

I think you probably want a package like https://periph.io/ which has support for using the hardware pins on a Raspberry Pi: https://periph.io/platform/raspberrypi/