I have tried to search and found a lot of topics which are related to my problem, but none of them I could follow to success. I can go run
and go get
with no issues, but I need to compile into windows and there I have problems please see bellow
mikhail@mikhail-desktop:/usr/lib/go/src$ sudo ./make.bash
# Building C bootstrap tool.
cmd/dist
go tool dist: $GOROOT is not set correctly or not exported
GOROOT=/usr/share/go
/usr/share/go/include/u.h does not exist
mikhail@mikhail-desktop:/usr/lib/go/src$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mikhail/Documents/FL/0go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
TERM="dumb"
CC="gcc"
GOGCCFLAGS="-g -O2 -fPIC -m64 -pthread"
CXX="g++"
CGO_ENABLED="1"
mikhail@mikhail-desktop:/usr/lib/go/src$
By some reasons it thinks the GOROOT is /usr/share/go
while it actually /usr/lib/go
I think it somehow connected to Debian/Ubuntu thing. I seen such issues but related to 0.9. version.
I have installed go from source into ~/go and then everything went quite OK, now I can compile to windows from ubuntu with help Introduction to cross compilation with go and LiteIDE.
sudo
can clean environment variables, to check if that is the case here, run sudo $(which go) env
and check if the output is what you expect. If not, you can keep the enviroment of your user by using the -E
flag: sudo -E ./make.bash
.