英文:
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的源代码树:
- 安装MinGW和MSYS,以及MSYS Bison和其他您认为有用的工具(vim等)。
- 从GNUWin32项目安装ed。
- 安装Python和Mercurial。
- 将[Hectorchu-go-windows Mercurial存储库](https://hectorchu-go-windows.googlecode.com/hg/ hectorchu-go-windows)克隆到
C:\Go
。 - 运行MSYS shell(或rxvt)。以下是bash命令...
mkdir $HOME/bin
export PATH=$HOME/bin:$PATH
export GOROOT=C:\\Go
export GOARCH=386
export GOOS=mingw
cd /c/Go/src
./all.bash
- 根据输出的错误进行修正,重复步骤10直到开始构建。
这与Linux或MacOS上的操作方式基本相同。
然而,我仍然坚持我在上面的评论中所说的:这不一定会生成任何实际可用的东西。除非您有兴趣协助移植工作,否则最好等待此工作合并到主Go树之后再进行处理。
***更新:***现在有一个基本可用的预构建的Windows版本可供使用,对于那些不想自己构建编译器的人来说。然而,考虑到项目的变化速度,缺乏正式发布(除了hg的“release”标签)以及Hector的更改很快被合并到主分支的可能性,通过源代码构建来跟踪开发可能会产生更好的结果。
英文:
Assuming you are using Hector's source tree:
- Install MinGW and MSYS, along with MSYS Bison and any other tools you think you'll find useful (vim, etc).
- Install ed from the GNUWin32 project.
- Install Python and Mercurial.
- Clone the [hectorchu-go-windows mercurial repository](https://hectorchu-go-windows.googlecode.com/hg/ hectorchu-go-windows) to
C:\Go
. - Run an MSYS shell (or rxvt). The rest of these are bash commands...
mkdir $HOME/bin
export PATH=$HOME/bin:$PATH
export GOROOT=C:\\Go
export GOARCH=386
export GOOS=mingw
cd /c/Go/src
./all.bash
- 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/
答案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).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论