raylib-go/examples/rpi/basic_window
2017-12-05 19:45:13 +01:00
..
bootstrap.sh OpenAL is no more 2017-12-05 19:45:13 +01:00
main.go RPi example 2017-02-22 12:11:18 +01:00
README.md RPi example 2017-02-22 12:11:18 +01:00

Raspberry Pi example

To compile example for Raspberry Pi you will need RPi toolchain and userspace libraries, and Go must be cross compiled for linux/arm with that toolchain.

There is a bootstrap.sh script that you can use to cross compile Go and OpenAL.

Compile Go and OpenAL, /usr/local is prefix where Go and RPi toolchain and libraries will be installed:

./bootstrap.sh /usr/local

After build is complete point GOROOT to new Go installation in /usr/local, and add toolchain bin directory to PATH:

export GOROOT=/usr/local/go
export PATH=/usr/local/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:${PATH}

And compile example:

CGO_CFLAGS="-I/usr/local/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/include -I/usr/local/vc/include -I/usr/local/vc/include/interface/vcos -I/usr/local/vc/include/interface/vmcs_host/linux -I/usr/local/vc/include/interface/vcos/pthreads" \
CGO_LDFLAGS="-L/usr/local/vc/lib -L/usr/local/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/lib -ldl" \
CC=arm-linux-gnueabihf-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=6 ${GOROOT}/bin/go build -v -x