frosch03.de/posts/2016-05-10-mu4e-within-cygwin

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 cygwin.com, 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.

For more information on cygwin, have a look at this cygwin cheat sheet.

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:

{% highlight bash %} cd /tmp git clone https://github.com/djcb/mu.git cd mu {% endhighlight %}

Compiling mu

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

So add the path to Makefile.am into the variable ACLOCAL_AMFLAGS:

{% highlight makefile %} ACLOCAL\_AMFLAGS=-I m4 -I /usr/share/aclocal {% endhighlight %}

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:

{% highlight bash %} ln -s /usr/x86\_64-w64-mingw32/sys-root/mingw/include/iconv.h /usr/include/iconv.h {% endhighlight %}

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:

{% highlight bash %} autoreconf -i ./configure make make install {% endhighlight %}

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 <http://gnu.org/licenses/gpl.html>.
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

<!– * default packages that are installed –>

<!– - binutils :: 2.25-4 –>

<!– - bzip2 :: 1.0.6-2 –>

<!– - ca-certificates :: 2.7-1 –>

<!– - csih :: 0.9.9-1 –>

<!– - cygrunsrv :: 1.62-1 –>

<!– - cygwin-devel :: 2.5.1-1 –>

<!– - dejavu-fonts :: 2.35-2 –>

<!– - desktop-file-utils :: 0.22-2 –>

<!– - diffutils :: 3.3-3 –>

<!– - dri-drivers :: 11.2.1-1 –>

<!– - emacs :: 24.5-2 –>

<!– - gamin :: 0.1.10-15 –>

<!– - groff :: 1.22.3-1 –>

<!– - gsettings-desktop-schemas :: 3.18.1-1 –>

<!– - less :: 481-1 –>

<!– - libargp :: 20110921-2 –>

<!– - libattr1 :: 2.4.46-1 –>

<!– - libautotrace3 :: 0.31.1-17 –>

<!– - libblkid1 :: 2.25.2-2 –>

<!– - libbz2_1 :: 1.0.6-2 –>

<!– - libcairo2 :: 1.14.4-1 –>

<!– - libcom_err2 :: 1.42.12-2 –>

<!– - libcroco0.6_3 :: 0.6.9-1 –>

<!– - libcrypt0 :: 1.3-1 –>

<!– - libcurl4 :: 7.48.0-1 –>

<!– - libdatrie1 :: 0.2.8-1 –>

<!– - libdb5.3 :: 5.3.21-1 –>

<!– - libdbus1_3 :: 1.10.8-1 –>

<!– - libedit0 :: 20130712-1 –>

<!– - libEGL1 :: 11.2.1-1 –>

<!– - libEMF1 :: 1.0.7-1 –>

<!– - libexpat1 :: 2.1.1-1 –>

<!– - libfam0 :: 0.1.10-15 –>

<!– - libffi6 :: 3.2.1-2 –>

<!– - libfftw3_3 :: 3.3.4-3 –>

<!– - libfontconfig-common :: 2.11.94-1 –>

<!– - libfontconfig1 :: 2.11.94-1 –>

<!– - libfpx1 :: 1.3.1.4-1 –>

<!– - libfreetype6 :: 2.5.5-2 –>

<!– - libgcc1 :: 5.3.0-5 –>

<!– - libgd3 :: 2.1.1-1 –>

<!– - libgdbm4 :: 1.11-1 –>

<!– - libgdk_pixbuf2.0_0 :: 2.32.2-1 –>

<!– - libgif4 :: 4.1.6-12 –>

<!– - libGL1 :: 11.2.1-1 –>

<!– - libglapi0 :: 11.2.1-1 –>

<!– - libglib2.0_0 :: 2.46.2-3 –>

<!– - libgmp10 :: 6.1.0-3p1 –>

<!– - libgnutls28 :: 3.3.17-1 –>

<!– - libgomp1 :: 5.3.0-5 –>

<!– - libgraphite2_3 :: 1.3.6-1 –>

<!– - libgs9 :: 9.15-2 –>

<!– - libgssapi_krb5_2 :: 1.14.1-1 –>

<!– - libharfbuzz0 :: 1.0.6-1 –>

<!– - libhogweed2 :: 2.7.1-1 –>

<!– - libICE6 :: 1.0.9-1 –>

<!– - libiconv :: 1.14-3 –>

<!– - libiconv2 :: 1.14-3 –>

<!– - libidn11 :: 1.29-1 –>

<!– - libintl8 :: 0.19.7-1 –>

<!– - libjasper1 :: 1.900.1-15 –>

<!– - libjbig2 :: 2.0-14 –>

<!– - libjpeg8 :: 1.4.2-1 –>

<!– - libk5crypto3 :: 1.14.1-1 –>

<!– - libkrb5support0 :: 1.14.1-1 –>

<!– - libkrb5_3 :: 1.14.1-1 –>

<!– - liblcms2_2 :: 2.6-1 –>

<!– - libllvm3.7 :: 3.7.1-1 –>

<!– - liblzma5 :: 5.2.2-1 –>

<!– - liblzo2_2 :: 2.08-1 –>

<!– - libMagickC++6_5 :: 6.9.0.0-4 –>

<!– - libMagickCore6_2 :: 6.9.3.10-1 –>

<!– - libMagickWand6_2 :: 6.9.3.10-1 –>

<!– - libming1 :: 0.4.7-1 –>

<!– - libmpfr4 :: 3.1.4-1 –>

<!– - libncursesw10 :: 6.0-5.20160423 –>

<!– - libnettle4 :: 2.7.1-1 –>

<!– - libnghttp2_14 :: 1.7.1-1 –>

<!– - libopenldap2_4_2 :: 2.4.42-1 –>

<!– - libp11-kit0 :: 0.22.1-1 –>

<!– - libpango1.0_0 :: 1.38.1-1 –>

<!– - libpaper-common :: 1.1.24-2 –>

<!– - libpaper1 :: 1.1.24-2 –>

<!– - libpcre1 :: 8.38-3 –>

<!– - libpipeline1 :: 1.4.0-1 –>

<!– - libpixman1_0 :: 0.32.8-1 –>

<!– - libplotter2 :: 2.6-5 –>

<!– - libpng16 :: 1.6.20-1 –>

<!– - libpopt0 :: 1.16-1 –>

<!– - libpsl5 :: 0.13.0-1 –>

<!– - libpstoedit0 :: 3.70-1 –>

<!– - librsvg2_2 :: 2.40.11-1 –>

<!– - libsasl2_3 :: 2.1.26-9 –>

<!– - libsigsegv2 :: 2.10-2 –>

<!– - libSM6 :: 1.2.2-1 –>

<!– - libsmartcols1 :: 2.25.2-2 –>

<!– - libsqlite3_0 :: 3.12.2-1 –>

<!– - libssh2_1 :: 1.7.0-1 –>

<!– - libssp0 :: 5.3.0-5 –>

<!– - libstdc++6 :: 5.3.0-5 –>

<!– - libtasn1_6 :: 4.7-1 –>

<!– - libthai0 :: 0.1.21-1 –>

<!– - libtiff6 :: 4.0.6-1 –>

<!– - libunistring2 :: 0.9.6-1 –>

<!– - libuuid-devel :: 2.25.2-2 –>

<!– - libuuid1 :: 2.25.2-2 –>

<!– - libvpx1 :: 1.3.0-2 –>

<!– - libwebp5 :: 0.4.3-1 –>

<!– - libX11-xcb1 :: 1.6.3-1 –>

<!– - libX11_6 :: 1.6.3-1 –>

<!– - libXau6 :: 1.0.8-1 –>

<!– - libXaw7 :: 1.0.13-1 –>

<!– - libxcb-glx0 :: 1.11.1-1 –>

<!– - libxcb-render0 :: 1.11.1-1 –>

<!– - libxcb-shm0 :: 1.11.1-1 –>

<!– - libxcb1 :: 1.11.1-1 –>

<!– - libXdmcp6 :: 1.1.2-1 –>

<!– - libXext6 :: 1.3.3-1 –>

<!– - libXft2 :: 2.3.2-1 –>

<!– - libxml2 :: 2.9.3-1 –>

<!– - libXmu6 :: 1.1.2-1 –>

<!– - libXpm-noX_4 :: 3.5.10-1 –>

<!– - libXpm4 :: 3.5.11-1 –>

<!– - libXrender1 :: 0.9.9-1 –>

<!– - libXt6 :: 1.1.5-1 –>

<!– - libzip2 :: 0.11.2-2 –>

<!– - lynx :: 2.8.7-2 –>

<!– - openssh :: 7.2p2-1 –>

<!– - p11-kit :: 0.22.1-1 –>

<!– - p11-kit-trust :: 0.22.1-1 –>

<!– - perl-Carp :: 1.38-1 –>

<!– - perl-Error :: 0.17024-1 –>

<!– - perl-TermReadKey :: 2.33-1 –>

<!– - perl_base :: 5.22.2-1 –>

<!– - popt :: 1.16-1 –>

<!– - python :: 2.7.10-1 –>

<!– - rsync :: 3.1.2-1 –>

<!– - shared-mime-info :: 1.6-3 –>

<!– - terminfo-extra :: 6.0-5.20160423 –>

<!– - xz :: 5.2.2-1 –>

<!– - zlib0 :: 1.2.8-3 –>

<!– * packages for libgtk3-devel –>

<!– - adwaita-icon-theme :: 3.18.0-1 –>

<!– - at-spi2-core :: 2.18.3-1 –>

<!– - compositeproto :: 0.4.2-1 –>

<!– - damageproto :: 1.2.1-1 –>

<!– - dconf-service :: 0.24.0-1 –>

<!– - fixesproto :: 5.0-1 –>

<!– - gdk-pixbuf2.0-svg :: 2.40.11-1 –>

<!– - girepository-Atk1.0 :: 2.18.0-1 –>

<!– - girepository-Atspi2.0 :: : : 2.18.3-1 –>

<!– - girepository-GdkPixbuf2.0 :: : : 2.32.2-1 –>

<!– - girepository-Gtk3.0 :: : : 3.18.9-1 –>

<!– - girepository-x11 :: 1.46.0-1 –>

<!– - glib2.0-networking :: 2.46.1-1 –>

<!– - gtk-update-icon-cache :: 3.18.9-1 –>

<!– - hicolor-icon-theme :: 0.15-1 –>

<!– - inputproto :: 2.3.1-1 –>

<!– - kbproto :: 1.0.7-1 –>

<!– - libatk-bridge2.0-devel :: 2.18.1-1 –>

<!– - libatk-bridge2.0_0 :: 2.18.1-1 –>

<!– - libatk1.0-devel :: 2.18.0-1 –>

<!– - libatk1.0_0 :: 2.18.0-1 –>

<!– - libatspi-devel :: 2.18.3-1 –>

<!– - libcairo-devel :: 1.14.4-1 –>

<!– - libdbus1-devel :: 1.10.8-1 –>

<!– - libEGL-devel :: 11.2.1-1 –>

<!– - libepoxy0 :: 1.2-1 –>

<!– - libexpat-devel :: 2.1.1-1 –>

<!– - libfreetype-devel :: 2.5.5-2 –>

<!– - libgdk_pixbuf2.0-devel :: 2.32.2-1 –>

<!– - libgtk3_0 :: 3.18.9-1 –>

<!– - libjson-glib1.0_0 :: 1.0.4-1 –>

<!– - libpango1.0-devel :: 1.38.1-1 –>

<!– - libpixman1-devel :: 0.32.8-1 –>

<!– - libpng-devel :: 1.6.20-1 –>

<!– - libpng16-devel :: 1.6.20-1 –>

<!– - libproxy1 :: 0.4.11-5 –>

<!– - libsoup-gnome2.4_1 :: 2.52.2-1 –>

<!– - libsoup2.4_1 :: 2.52.2-1 –>

<!– - libX11-devel :: 1.6.3-1 –>

<!– - libxcb-devel :: 1.11.1-1 –>

<!– - libXcomposite1 :: 0.4.3-1 –>

<!– - libXcursor-devel :: 1.1.14-1 –>

<!– - libXcursor1 :: 1.1.14-1 –>

<!– - libXdamage-devel :: 1.1.4-1 –>

<!– - libXdamage1 :: 1.1.4-1 –>

<!– - libXdmcp-devel :: 1.1.2-1 –>

<!– - libXext-devel :: 1.3.3-1 –>

<!– - libXfixes-devel :: 5.0.1-1 –>

<!– - libXfixes3 :: 5.0.1-1 –>

<!– - libXft-devel :: 2.3.2-1 –>

<!– - libXi-devel :: 1.7.6-1 –>

<!– - libXi6 :: 1.7.6-1 –>

<!– - libXinerama-devel :: 1.1.3-1 –>

<!– - libXinerama1 :: 1.1.3-1 –>

<!– - libXrandr-devel :: 1.5.0-1 –>

<!– - libXrandr2 :: 1.5.0-1 –>

<!– - libXrender-devel :: 0.9.9-1 –>

<!– - libXtst6 :: 1.2.2-1 –>

<!– - randrproto :: 1.5.0-1 –>

<!– - renderproto :: 0.11.1-1 –>

<!– - xextproto :: 7.3.0-1 –>

<!– - xineramaproto :: 1.2.1-1 –>

<!– - xproto :: 7.0.28-1 –>

<!– - zlib-devel :: 1.2.8-3 –>

<!– * packages for libwebkitgtk3.0-devel –>

<!– - gcr :: 3.18.0-1 –>

<!– - girepository-Soup2.4 :: 2.52.2-1 –>

<!– - gnome-keyring :: 3.18.3-1 –>

<!– - libaspell15 :: 0.60.6.1-1 –>

<!– - libdbus-glib_1_2 :: 0.106-1 –>

<!– - libenchant1 :: 1.6.0-2 –>

<!– - libgailutil3_0 :: 3.18.9-1 –>

<!– - libgck1_0 :: 3.18.0-1 –>

<!– - libgcr-base3_1 :: 3.18.0-1 –>

<!– - libgcr-ui3-common :: 3.18.0-1 –>

<!– - libgcr-ui3_1 :: 3.18.0-1 –>

<!– - libgcrypt20 :: 1.6.4-1 –>

<!– - libgeoclue0 :: 0.12.99-2 –>

<!– - libgpg-error0 :: 1.19-1 –>

<!– - libgstinterfaces1.0_0 :: 1.6.3-1 –>

<!– - libgstreamer1.0_0 :: 1.6.3-1 –>

<!– - libharfbuzz-icu0 :: 1.0.6-1 –>

<!– - libhunspell1.3_0 :: 1.3.3-1 –>

<!– - libicu56 :: 56.1-1 –>

<!– - libjavascriptcoregtk3.0-devel :: 2.0.4-5 –>

<!– - libjavascriptcoregtk3.0_0 :: 2.0.4-5 –>

<!– - liborc0.4_0 :: 0.4.23-1 –>

<!– - libsecret1_0 :: 0.18.3-1 –>

<!– - libsoup2.4-devel :: 2.52.2-1 –>

<!– - libvoikko1 :: 3.7.1-1 –>

<!– - libwebkitgtk3.0_0 :: 2.0.4-5 –>

<!– - libxml2-devel :: 2.9.3-1 –>

<!– - libxslt :: 1.1.28-2 –>

<!– - suomi-malaga :: 1.18-1 –>

<!– for some reason, this package also was installed: –>

<!– - libtxc_dxtn :: 1.0-1.20151227gitf6ec862 –>

<!– - vala-libsoup2.4 :: 2.52.2-1 –>

<!– * packages installed later –>

<!– ** Default –>

<!– - emacs-w32 :: 24.5-2 –>

<!– - git :: 2.8.2-1 –>

<!– ** For generic compiling –>

<!– - autoconf :: 13-1 –>

<!– - autoconf :: 2.13-12 –>

<!– - autoconf :: 2.69-3 –>

<!– - m4 :: 1.4.17-2 –>

<!– - perl :: 5.22.2-1 –>

<!– - perl_autorebase :: 5.22.2-1 –>

<!– - automake :: 9-1 –>

<!– - automake1.10 :: 1.10.3-2 –>

<!– - automake1.11 :: 1.11.6-2 –>

<!– - automake1.12 :: 1.12.6-2 –>

<!– - automake1.13 :: 1.13.4-1 –>

<!– - automake1.14 :: 1.14.1-2 –>

<!– - automake1.15 :: 1.15-1 –>

<!– - automake1.4 :: 1.4p6-11 –>

<!– - automake1.5 :: 1.5-11 –>

<!– - automake1.6 :: 1.6.3-12 –>

<!– - automake1.7 :: 1.7.9-11 –>

<!– - automake1.8 :: 1.8.5-11 –>

<!– - automake1.9 :: 1.9.6-11 –>

<!– - perl-Pod-Simple :: 3.32-1 –>

<!– - perl-Unicode-Normalize :: 1.25-1 –>

<!– - texinfo :: 6.1-2 –>

<!– - libtool :: 2.4.6-3 –>

<!– - lib… :: … –>

<!– - gcc-g++ :: 5.3.0-5 –>

<!– - gcc-core :: 5.3.0-5 –>

<!– - libatomic1 :: 5.3.0-5 –>

<!– - libisl13 :: 0.14.1-1 –>

<!– - libmpc3 :: 1.0.3-1 –>

<!– - libquadmath0 :: 5.3.0-5 –>

<!– - libvtv0 :: 5.3.0-5 –>

<!– - w32api-headers :: 4.0.4-1 –>

<!– - w32api-runtime :: 4.0.4-1 –>

<!– - windows-default-manifest :: 6.4-1 –>

<!– - pkg-config :: 0.29-1 –>

<!– - make :: 4.1-1 –>

<!– - libguile17 :: 1.8.8-1 –>

<!– ** For mu to compile –>

<!– - libglib2.0-devel :: 2.46.2-3 –>

<!– - libintl-devel :: 0.19.7-1 –>

<!– - libpcre-devel :: 8.38-3 –>

<!– - libpcre16_0 :: 8.38-3 –>

<!– - libpcre32_0 :: 8.38-3 –>

<!– - libpcrecpp0 :: 8.38-3 –>

<!– - libpcreposix0 :: 8.38-3 –>

<!– - libgmime2.6-devel :: 2.6.20-2 –>

<!– - libgmime2.6_0 :: 2.6.20-2 –>

<!– - libxapian-devel :: 1.2.18-2 –>

<!– - libxapian22 :: 1.2.18-2 –>

<!– - libgtk3-devel :: 3.18.9-1 –>

<!– - a lot (saved on windows pc) –>

<!– - libwebkitgtk3.0-devel :: 2.0.4-5 –>

<!– - a lot (saved on windows pc) –>

<!– - mingw64-x86_64-win-iconv :: 0.0.6-2 –>