MinGW

Steps to build are easy:

1. You need to install DevKit from rubyinstaller.org. Instructions for that are in RubyInstaller website wiki:

http://rubyinstaller.org/downloads

Note that this means you are installing Ruby. The RubyInstaller project has created this nice little package for bundling MinGW tools, so it's smart to take advantage of it. The tools are 32-bit only so for now these instructions only describe how to install a 32-bit library.

2. Start a command prompt and invoke devkitvars.bat found inside the folder you installed DevKit, this will give you access to MinGW tools.

3. Download ØMQ source somewhere and extract (eg C:\src\zeromq).

4. Compile it using the following commands:

C:\> cd C:\src\zeromq
C:\> sh configure --prefix=C:/path/to/zeromq/dir
C:\> make

Note the use of forwardslash in the second command. The above commands will take a long time to complete (5 minutes for the "configure" step, another 5 minutes for "make").

5. Copy the resulting DLLs

Now you can copy the DLL from inside /path/to/zeromq/dir/src/.libs/libzmq.dll into a directory in your PATH and use it.

6. Don't forget the additional dependencies

Copy libstdc++-6.dll and libgcc_s_sjlj-1.dll from DevKit MinGW into the same folder you copied libzmq.dll.

To know where these DLLs are, you can use where, eg:

C:\> where libstdc++-6.dll
C:\Users\Luis\Tools\DevKit\4.5.1\mingw\bin\libstdc++-6.dll

Alternative instructions using MSYS2 directly:

1. Install MSYS2 MSYS2 installation guide.

2. Make sure to choose the correct installation 32bit or 64bit.

3. Open the appropriate shell MSYS2 MinGW 64-bit or MSYS2 MinGW 32-bit. All further steps assume you are using this shell.

4. Update packages following instructions at the installation guide.

5. Install libtool pacman -Sy libtool.

6. Download zmq source code to a location of your choice.

7. Navigate to the zmq source folder.

8. To generate the configure file, run the autogen tool by running ./autogen.sh.

9. In the probable case that step 8 fails:
9.1. Find the file at fault (probably version.sh).
9.2. Replace line endings by (replace file by the actual filename).

cp file file.bak
tr -d '\r' <file.bak> file

9.3. If this fails you'll have to dive in the code and find the problem.

10. Run the configure tool ./configure.

11. In the probable case of failure. Comment out empty else clauses in the configure file.

12. Add Go to PATH: PATH=${PATH}:<go bin directory>.

13. Install Go Package: CGO_CFLAGS=-I/usr/local/include CGO_LDFLAGS=-L/usr/local/lib go get github.com/pebbe/zmq4