d2r2 / go-dht

Golang library to interact with DHT11/DHT22/DHT12 temperature and humidity sensors from Raspberry PI.
MIT License
133 stars 52 forks source link

Cross compilation is not working in macOS for raspberry #21

Open ckbonu opened 5 years ago

ckbonu commented 5 years ago

env GOOS=linux GOARCH=arm GOARM=5 go build godht.go.

command-line-arguments

./godht.go:24:15: undefined: dht.DHT11 ./godht.go:31:1: undefined: dht.ReadDHTxxWithRetry

This is example1

ckbonu commented 5 years ago

@d2r2 any ideas how can we migrate c library to gocode calculate the pulse data to actual values so that we can make total code independent of C.

That would be great deal for the people in IOT who wants to go with GO than python.

d2r2 commented 5 years ago

@ckbonu, hello. I have some historical reasons do not write whole library in Go: read README.md and you will find the answer.

Please, read #20 how to correctly perform "cross compilation". Honestly I don't know how cross complilation works on macOS (but I know how it works on Linux), but I guess you have a mistake in your command line (somehow you should have special c-compilter with ARM target architecture to be installed on your macOS).

Finally, download latest version of library, try to compile on macOS again (if you figure out how to get special c-compilter to you macOS), and let me know what happened.