Cross Compile Go File

sudo apt-get install gcc-arm-linux-gnueabihf

sudo apt-get install gcc-multilib g++-multilib Fix “fatal error: ‘sys/cdefs.h’ file not found # include <sys/cdefs.h>

sudo apt-get install linux-headers-generic Fix “fatal error: asm/errno.h: No such file or directory”

1
2
3
4
5
CC=arm-linux-gnueabihf-gcc GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 GOPATH=/opt/software/SimpleComputerRemote/Host GOROOT=/opt/software/go1.7 /opt/software/go1.7/bin/go env

CC=arm-linux-gnueabihf-gcc GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 GOPATH=/opt/software/SimpleComputerRemote/Host GOROOT=/opt/software/go1.7 /opt/software/go1.7/bin/go build -o bin/server-linux-arm.out -ldflags="-s -w" src/Rekap\ Remote\ Server.go

CC=arm-linux-gnueabihf-gcc GOOS=linux GOARCH=arm GOARM=6 CGO_ENABLED=1 GOPATH=/opt/software/SimpleComputerRemote/Host GOROOT=/opt/software/go1.5 /opt/software/go1.5/bin/go build -o bin/server-linux-arm.out -ldflags="-s -w" src/Rekap\ Remote\ Server.go

At the end, but fail to cross compile the SimpleComputerRemote project, so this article is just for reference.

Reference
http://linux-sunxi.org/Toolchain
[進階] 安裝 Raspberry Pi 的 Toolchain
http://www.veryarm.com/296.html
arm交叉編譯器gnueabi、none-eabi、arm-eabi、gnueabihf、gnueabi區別