Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Success building and running on Windows....(not really an issue but might help someone else) #42

djlawler opened this Issue · 10 comments

6 participants



  1. pull tip (as of today).
  2. Add this patch:


More detailed instructions:

If anyone wants to set up a build environment on windows, you need:
MinGW and MSYS. An easy way (but 32 bit only and a bit 'non-standard'), is to
use this installer:

If you don't use this installer the paths you need to use will be different than the ones I use!

Get and unzip into the top level directory, bison, diffutils, ed from the Gnuwin32 project.
You need the binaries, the dev packages and the dependancies!

Use Tortoisehg or command line hg to pull the latest go source to C:\MinGW\go
Set the environment variables needed for go:
GOARCH set to: 386
GOBIN set to: C:/MinGW/go/bin
GOOS set to: windows
GOROOT set to: C:/MinGW/go

Add the patch at:
(I'll add the steps required to do this if anyone really cares) ;)

Build go by launching MSYS using C:\MinGW\msys.bat and cd to /go/src and entering the command ./all.bash

Get gtk+ from here:

You also need both the bin and dev files from here:
and from here:
you need the bin and dev files for the libxml2 library.

Unpack all of these into C:\MinGW\gtk+, then follow the directions in the gtk+-bundle_2.22.1-20101227_win32.README.txt to make pkg-configure happy.

Copy the msys.bat file at C:\MinGW to msysgo.bat and add set GOBIN=/go/bin
set GOROOT=/go near the top.

Pull the latest version of go-gtk using TortoiseGit or command line git to: C:\MinGW\go-gtk. Then start MSYS again using the msysgo.bat file...and cd /go-gtk and follow the directions in the file to create go-gtk and the example programs.

I had to copy the zlib1.dll file from C:\MinGW\gtk+\bin into the examples before they would run.

I hope this helps! If it is too complex, just wait and I'm sure someone will get a pre-packaged windows installer going sometime soon...


I did also as your said. :)
And I feed that this installation is too difficult for many people.
I want to add installation help. that's todo!


as of release 32e6fff7fbb3 on Thu Feb 10 20:39 no patching is required. You can just get the latest version of the go source, compile go and then go-gtk works on windows! Now for a dumb question: Is there anyway to suppress the console?




Thanks you too.
However, I must add install manual for windows user. I'll keep this issue.


I was able to set up a good build environment by installing MinGW from their standard installer (dated 02-11-2011). I checked off the C++ compiler (for other projects), and MSYS Basic System and MinGW Developer Toolkit. I only need to add ed and it's depandancies from Gnuwin32 into C:\MinGW\msys\1.0\bin (just ed.exe and regex2.dll). I then grabbed the go source and put it at C:\MinGW\go and was able to compile it with no issues. I use a batch file called msysgo.bat located at C:\MinGW to adjust some go environment variables and start bash.

set GOBIN=/c/MinGW/go/bin
set GOROOT=/c/MinGW/go

I was then able to build go-gtk following the same methods as my first post.

It's ALMOST getting easy :)


Thanks for your report!

LRN commented

You can set GOBIN and GOROOT in /etc/profile.d/ (assuming that /etc/profile does run scripts in profile.d ; stock /etc/profile from Msys does that, but you might have modified it after that)


nice article to me


I had some problems understanding this article. I'm on Windows 8 and can't comprehend why I would need to install a Linux system under Windows. All I need for developing Go programs, I believe, is the Go library and compiler (which already runs under Windows, right?), a separate file system tree for development files, an editor, and an optional batch file to set up environment variables. What am I missing in my understanding? I don't think I need any source control system, since I will just be experimenting for some time.

Go seems available native for Windows, so no form of Linux is needed, right?

And your step one, "pull tip", makes no sense. What are the definitions of these words? Am I seeing in issue 42 only part of a larger piece of advice?

Finally, what is this patch (fix mmap breakage on Windows) for? There is no explanation. What is being patched? Do I really need this patch for general programming?

I would think that help for Windows users should make sense for Windows users. Yes?

I'm going to proceed to see if I can set up a development environment for Go following the Go documentation. If I fail, I will assume it is because it can't actually be done and I will abandon Go.

Is that reasonable? Seems so to me. Anyway, it's now two years later, so this posting might not even be relevant anymore.


@David263 I make my own answer to limit @omac777 answer that I feel too brutal :)

Ok, I'm a C/C++, Perl, Python, PHP, JS, Java developper and I'm a fan of Golang for 2 years (excuse my english). I'm a Linux user (no windows since 1999) but I use to make some tests on Windows. That's my work, I must think about Windows users.

I guess you are confusing about Go, and Go-Gtk. Go/Golang is a language that is windows compatible. You can develop without any Cygwin/Linux installation.
But !
GTK is a Toolkit designed for Linux. It was ported to Windows to compile The Gimp. What Go-GTK need to be able to compile a Windows binary is to have good links to GTK library.
Because Golang is statically compiled, you must have GTK devel files (dlls, headers, static libraries).

For now, GoGTK is designed to get GTK bindings from Linux implementation, Windows Implementation is not exactly the same.

To have static libraries from GTK, you need to compile sources. And the problem is that, as I said before, GTK is originaly a Linux library... Windows compilers are not very well designed to compile that kind of libraries. So, to be able to compile GTK, and so to allow Go compiler to link libraries, you need a compiler that is able to make the link edition. That's why MingW, Cygwin and other tools should be installed on you Windows host.

As soon as you have succefully installed (and maybe patched) that installation, you can use GoGTK.

Keep in mind that GoGTK is not "Go", and that the problem is Windows, not GTK... Keep in mind that you can use Go on windows without Linux.

I'm developping some tools in Go that works great on Windows... I (at this time) don't use GoGTK on Windows. But you can try GoQML while GoGTK is not (at this time) ready to be easilly used on Windows if you're not ready to spend time to make a build environnement.

Sorry for my bad english.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.