Go语言在将Ubuntu上的./make.bash安装到Windows时出现问题。

huangapple go评论89阅读模式
英文:

Go lang installation issues with ./make.bash ubuntu->windows

问题

我尝试搜索并找到了很多与我的问题相关的主题,但是我没有成功地按照它们的步骤进行操作。
我可以使用go rungo get命令没有问题,但是我需要编译到Windows上,而在那里我遇到了问题,请看下面的内容:

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$

由于某些原因,它认为GOROOT是/usr/share/go,而实际上它是/usr/lib/go

英文:

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

答案1

得分: 1

sudo可以清除环境变量,要检查这种情况是否存在,请运行sudo $(which go) env命令,并检查输出是否符合预期。如果不符合预期,您可以使用-E标志保留用户的环境变量:sudo -E ./make.bash

英文:

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.

答案2

得分: 0

我认为这与Debian/Ubuntu有关。我见过类似的问题,但与0.9版本有关。

我已经从源代码安装了go到~/go目录下,然后一切都很顺利,现在我可以使用使用go进行交叉编译的介绍LiteIDE在Ubuntu上编译到Windows。

英文:

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.

huangapple
  • 本文由 发表于 2015年4月11日 18:23:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/29576770.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定