How to compile golang source code in windows

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

How to compile golang source code in windows

问题

我想编译golang的源代码(http://golang.org/dl/go1.3.src.tar.gz)。因为我想学习编译技术,甚至可能会修改go编译器的源代码。有人可以告诉我如何做吗?

注意,我只想在Windows上进行编译,而不是在Linux上。谢谢!

英文:

I want to compile the source code of golang (http://golang.org/dl/go1.3.src.tar.gz). Because I want to leran the technologies of compilation, even I will modify the sources codes of go compiler. Can anyone tell me how to do it?

Attention, I just want to compile it in windows, not in linux. Thanks!

答案1

得分: 3

在Windows上比在Linux上稍微复杂一些。

  1. 首先,你需要安装MinGW GCC工具链,并确保将其添加到环境变量中。
  • 不详细介绍安装过程,因为链接中的官方HOWTO已经非常详细了。
  1. 下载Go的源代码,解压缩后,在终端中进入path-to-go/src目录。
  2. 运行all.bat,如果一切顺利,一段时间后你应该会看到输出ALL TESTS PASSED
英文:

It's a little bit more complicated on windows than on Linux

  1. You have to install the MinGW GCC tool chain and make sure you put it in your path.
  • Not going into details because the official HOWTO on that link is very detailed.
  1. Download Go's source, unpack it, open a terminal and cd path-to-go/src.
  2. run all.bat, if all goes well you should get ALL TESTS PASSED printed out after a while.

答案2

得分: 0

这对我来说很有效。我可以使用这种方法在Windows 7和8.1上同时运行32位和64位的Go。

你可能也想尝试一下这个。

Go MinGW

英文:

This works well for me. I can get both 32 bit and 64 bit go working on windows 7 and 8.1 using this method:

Go WindowsBuild

You might like to also give this a go.

Go MinGW

huangapple
  • 本文由 发表于 2014年6月22日 23:49:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/24352922.html
匿名

发表评论

匿名网友

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

确定