You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I downloaded the lib via go get -u github.com/d2r2/go-dht.
Thereby compile the binary on my Arch Linux system. Therefore I give the ARM, OS and ARCH variables so that the binary is executable on the Pi. When compelling I get the following error:
You should remember, that since DHT library partially written in C (and your native system has no ARM7 architecture), and you employ "cross compilation techniques", so you should have on your system special cross c-compiler installed. The name of c-compiler for Debian/Ubuntu system will be arm-linux-gnueabi-gcc, for Arch Linux arm-linux-gnueabihf-gcc.
So, once you have this c-compiler, you must modify your compilation call accordingly:
for Debian/Ubuntu: CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7|6 go build
for Arch Linux: CC=arm-linux-gnueabihf-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=7|6 go build
Note: you should select ARM version 6 or 7. Regular Raspberry PI ordinary has 6.
I have one on my Arch Linux notebook where i'm doing all the development (and cross compilation works good), and as I remember arch ecosystem has this compiler only in AUR repository, so you should install it from here: https://aur.archlinux.org/packages/arm-linux-gnueabihf-gcc/
I think the hardest part here is installing a с-compiler, so try and let me know if you still need help.
d2r2
changed the title
compile error
cross compilations techniques compile error
Dec 3, 2018
I try to read out the data of my DHT11 sensor using the example. My Golang code looks like this:
I downloaded the lib via
go get -u github.com/d2r2/go-dht
.Thereby compile the binary on my Arch Linux system. Therefore I give the ARM, OS and ARCH variables so that the binary is executable on the Pi. When compelling I get the following error:
markus@markus-pc:~/go/src/dht11-example$ GOARM=7 GOOS=linux GOARCH=arm go build ./main.go:17:32: undefined: dht.ReadDHTxx ./main.go:17:46: undefined: dht.DHT11
Does anyone have any idea what I'm doing wrong?
The text was updated successfully, but these errors were encountered: