有人尝试在Windows上编译Go吗?它似乎现在支持生成PE格式的二进制文件。

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

Anybody tried to compile Go on Windows?, It appears to now support generating PE Format binaries

问题

如果您能成功编译它,我想知道具体的步骤。

英文:

http://code.google.com/r/hectorchu-go-windows/source/list

If you could compile it successfully, I like to know the procedures of how to.

答案1

得分: 5

假设您正在使用Hector的源代码树

  1. 安装MinGW和MSYS,以及MSYS Bison和其他您认为有用的工具(vim等)。
  2. GNUWin32项目安装ed
  3. 安装PythonMercurial
  4. 将[Hectorchu-go-windows Mercurial存储库](https://hectorchu-go-windows.googlecode.com/hg/ hectorchu-go-windows)克隆到C:\Go
  5. 运行MSYS shell(或rxvt)。以下是bash命令...
    1. mkdir $HOME/bin
    2. export PATH=$HOME/bin:$PATH
    3. export GOROOT=C:\\Go
    4. export GOARCH=386
    5. export GOOS=mingw
    6. cd /c/Go/src
    7. ./all.bash
    8. 根据输出的错误进行修正,重复步骤10直到开始构建。

这与Linux或MacOS上的操作方式基本相同。

然而,我仍然坚持我在上面的评论中所说的:这不一定会生成任何实际可用的东西。除非您有兴趣协助移植工作,否则最好等待此工作合并到主Go树之后再进行处理。

***更新:***现在有一个基本可用的预构建的Windows版本可供使用,对于那些不想自己构建编译器的人来说。然而,考虑到项目的变化速度,缺乏正式发布(除了hg的“release”标签)以及Hector的更改很快被合并到主分支的可能性,通过源代码构建来跟踪开发可能会产生更好的结果。

英文:

Assuming you are using Hector's source tree:

  1. Install MinGW and MSYS, along with MSYS Bison and any other tools you think you'll find useful (vim, etc).
  2. Install ed from the GNUWin32 project.
  3. Install Python and Mercurial.
  4. Clone the [hectorchu-go-windows mercurial repository](https://hectorchu-go-windows.googlecode.com/hg/ hectorchu-go-windows) to C:\Go.
  5. Run an MSYS shell (or rxvt). The rest of these are bash commands...
  6. mkdir $HOME/bin
  7. export PATH=$HOME/bin:$PATH
  8. export GOROOT=C:\\Go
  9. export GOARCH=386
  10. export GOOS=mingw
  11. cd /c/Go/src
  12. ./all.bash
  13. Correct errors as it spits them out at you, repeat step 10 until it starts building.

It's the same idea as on Linux or MacOS, basically.

However, I still stand by what I said in my comment above: this isn't necessarily going to generate anything that actually works yet. You'd be better served by waiting until this effort has merged into the main Go tree before tackling it, unless your interest is in assisting with the porting effort.

Update: there is now a mostly-functional pre-built windows port available, for those not interested in building the compiler themselves. However, given the rate of change of the project, the lack of formal releases (other than the hg "release" tag), and the possibility of Hector's changes being merged into the main branch soon, keeping up with development via source builds is likely to produce better results over time.

答案2

得分: 3

只是提供信息,现在似乎有官方的了。

http://code.google.com/p/go-windows/

英文:

Just FYI, there is seems official one now.

http://code.google.com/p/go-windows/

答案3

得分: 2

Hector说他只能编译和运行一个空的main函数。请参见问题107:

http://code.google.com/p/go/issues/detail?id=107

在移植这个代码时还有很多工作要做,特别是因为代码在ptrace和syscall上有很多依赖,更不用说Linux/BSD和Windows之间的不同线程模型了。

英文:

Hector said he was only able to get as far as being able to compile and run an empty main. See issue 107:

http://code.google.com/p/go/issues/detail?id=107

There is still a lot of work to do in porting that, especially since the code has lots of dependencies on ptrace and syscall, not to mention the different threading models between Linux/BSD and Windows.

答案4

得分: 1

更新:

golang-nuts论坛上有一个新的帖子(于2010年3月26日开始),其中包含一个最新版本的构建和一些当前的构建说明(使用MinGW+MSYS)。

英文:

Update:

There's a new thread on golang-nuts (started 26.03.2010) with a link to a recent build and some current building instructions (using MinGW+MSYS).

huangapple
  • 本文由 发表于 2009年11月21日 03:19:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/1772679.html
匿名

发表评论

匿名网友

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

确定