-1

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

Siguza
  • 21,155
  • 6
  • 52
  • 89
MikeKlemin
  • 909
  • 1
  • 8
  • 26

2 Answers2

1

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.

Jaime Soriano
  • 7,309
  • 2
  • 33
  • 45
  • Thank you! I had same thoughts, that may be I need to set up EXPORTS in /root/.bashrc ... But then I decided to try to get it install from source, and it worked... I can not verify now your suggestion, but I nearly sure you are right. – MikeKlemin Apr 11 '15 at 18:38
0

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.

MikeKlemin
  • 909
  • 1
  • 8
  • 26