May 10, 2016 - mu, mu4e, cygwin and windows


Installation of cygwin

If you don't have cygwin installed yet, i will go through that process pretty quick here. Download the latest cygwin installer from, I will use the 64 bit version and the cygwin DLL is of version 2.5.1 and the Setup.exe has version 2.874.

While installing cygwin, you will be asked to select the packages, that you want to install. You do not need to select any packages at this stage for a working cygwin installation. In any case, the installer will come up with a bunch of default packages. After this step you have a working cygwin installation on you windows machine. Go to C:\cygwin64\ and start the cygwin.bat to get a terminal.

Install basic packages

For later working with the emacs bindings of mu (mu4e) you need to have emacs installed within cygwin. I like to install the -w32 bindings of emacs (emacs-w32), so I have a graphical interface for emacs that works with the nativ window bindings.

Also for downloading the latest version of mu, git will come handy. I've therefore added these two packages to my cygwin installation:

  • emacs-w32 (24.5-2)
  • git (2.8.2-1)

BTW: This could be achieved by opening the installer (setup-x86_64.exe) again and selecting the desired packages for installation.

Install packages for compiling

You're going to compile mu from scratch, therefore the needed tools must be installed within cygwin. These are at least a C/C++ compiler and the make tool chain. Go ahead and install the following packages:

  • autoconf (13-1)
  • automake (9-1)
  • libtool (2.4.6-3)
  • gcc-g++ (5.3.0-5)
  • pkg-config (0.29-1)
  • make (4.1-1)

The installer will resolve all dependencies and will come up with a bunch of additional packages.

You have now setup a cygwin setup, ready for compiling C/C++ code.

Install packages for mu

The last packages you need to install are the dependencies of mu. These are the library's glib, gmime and xapian. If you would like to have the graphical interface, you need to install gtk3 and webkitgtk3. I myself have never used or tested the graphical user front end, so I can't tell anything about it. If you have experience here, feel free to share your knowledge in the comments.

In any case, you will need the iconv.h header file, which is part of the package mingw64-x86_64-win-iconv.

You need the following packages to be installed:

  • libglib2.0-devel (2.46.2-3)
  • libgmime2.6-devel (2.6.20-2)
  • libxapian-devel (1.2.18-2)
  • mingw64-x86_64-win-iconv (0.0.6-2)

And for the graphical frontend:

  • libgtk3-devel (3.18.9-1)
  • libwebkitgtk3.0-devel (2.0.4-5)

With these packages all dependencies are installed.

Downloading the latest mu

The mailutils mu are distributed via github. Therefore it's pretty easy to get the latest version:

cd /tmp
git clone
cd mu

Compiling mu

For some reason, pkg.m4 is found within cygwin at a different location, which must be announced within On windows pkg.m4 is found under /usr/share/aclocal.

So add the path to into the variable ACLOCAL_AMFLAGS:

ACLOCAL_AMFLAGS=-I m4 -I /usr/share/aclocal

To avoid a fatal error while compiling mu, the iconv.h must be in the include-path of the compiler. As you installed the packet mingw64-x86_64-win-iconv, you should find iconv.h at: /usr/x86_64-w64-mingw32/sys-root/mingw/include/iconv.h. To make that visible for the compiler, I like to create a symbolic link to that specific file file right at /usr/include by:

ln -s /usr/x86_64-w64-mingw32/sys-root/mingw/include/iconv.h /usr/include/iconv.h

Another fix is needed before you are able to start the compile process. Within /usr/include/xapian/version.h you need to comment out the compiler check. This check tests for the equality of the compiler xapian was compiled with and the one that now tries to compile mu. As this will most likely be never be the case you are forced to drop this check. (Is there a better solution?)

The check is everything between line 23 and line 32. I do not knwo a more clean solution here, but it seems that this hack is working just fine. (At least for me it was)

Also within my version.h there where multiple #endif statements closing the _GLIBCXX_DEBUG section. Delete all except for the last one.

After this fixes, mu should compile just fine:

autoreconf -i
make install

If the installation was successful you should get the version information of mu with the command mu --version:

mu (mail indexer/searcher) version 0.9.17
Copyright (C) 2008-2015 Dirk-Jan C. Binnema
License GPLv3+: GNU GPL version 3 or later <>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Congratulations, you have compiled mu within your cygwin environment and are able to use it from now on.

Read on: how to setup offlineimap within cygwin