I am trying to cross compile some Go code for ARM architecture and am running into an issue with the compiler flags.
When I try to build my project I get some undefined errors relating to pcap
[brandon@f4998 src]$ go build
# _/home/brandon/IdeaProjects/new-snap/src
./main.go:120: undefined: pcap.OpenLive
./main.go:120: undefined: pcap.BlockForever
I assumed this was because I need to include -lpcap when compiling so I set the GOGCCFLAGS environment variable to include -lpcap. However, this does not work because go is reading the $GOGCCFLAGS from somewhere else
[brandon@f4998 src]$ export GOGCCFLAGS=-lpcap
[brandon@f4998 src]$ echo $GOGCCFLAGS
-lpcap
[brandon@f4998 src]$ go version
go version go1.5.4 linux/amd64
[brandon@f4998 src]$ go env
GOARCH="arm"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/brandon/IdeaProjects/new-snap"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT=""
CC="arm-linux-gnu-gcc"
GOGCCFLAGS="-fPIC -marm -fmessage-length=0"
CXX="arm-linux-gnu-g++"
CGO_ENABLED="0"
All of the other variables seem to be set correctly, but nothing happens when I set $GOGCCFLAGS