Compiling on Windows

Compiling on windows is not especially easy. The instructions below have worked at least once. This file loosely explains how to compile Kaya on Windows. You may need to consult the documentation of the packages you install at times. Leave plenty of time.

These instructions assume that you don’t have any of the MinGW software already installed – if you do, obviously you’ll be able to skip some steps. Unfortunately, compiling with Cygwin is not possible at the moment as it does not support wide characters.

Step 1: Basic environment

Go to MinGW and download the Binutils, MinGW-make, mingw-runtime, mingw-utils and w32api packages. Unpack them all to the same directory.

Download (still from MinGW) and install msys, msysDTK, msys-autoconf, msys-automake and msys-libtool.

Finally, download and install a C compiler into your mingw package. Any version of gcc should work.

Run Msys (the installation process installs a Start Menu icon for an Msys terminal) to generate your home directory.

Step 2: Build-dependencies

Now, get the build dependencies (and compile them in this order via MSys). Always configure with --prefix=/mingw These instructions assume you’ll be compiling from source – there are windows binary builds available for some of them. Unless otherwise stated, a standard ./configure --prefix=/mingw && make && make install is all you need.

  1. libgc garbage collector – version 6.5 works, and possibly others do too, but compiling a version that works nicely with Kaya, windows and minGW is very hit-and-miss. You’ll know if it’s wrong because every Kaya app will instantly segfault. If this happens, use our binary distribution of libgc, from the one time we got it working – just uncompress it in /mingw. If you find a way to compile libgc that works reliably, please let us know! Make sure you enable win32 threads, and the C++ interface.
  2. libpcre (perl compatible regular expressions)This one is straightforward – get the binary setup executable from the GNUwin32 project and install it into your MinGW base directory.
  3. libgpg-error (GnuPG support library). This one is straightforward too, just get it from GnuPG and compile.
  4. libgcrypt (cryptography)Again, get it from GnuPG. It doesn’t compile without tweaks on MinGW. Joe Testa wrote instructions for compiling libgcrypt in MinGW, but because the MinGW/MSys environment constructed so far doesn’t have all the extra utilities, and some of our install paths are different, we’ve had to modify them. After downloading and unpacking the libgcrypt source:
    1. Find the line ac_cv_sys_symbol_underscore=yes in ./configure (there’s only one), and add | i686-pc-mingw32 to the line above so that it reads i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp | i686-pc-mingw32)
    2. Run ./configure --prefix=/mingw && make – this will error out on random.c, but don’t worry about it.
    3. Download Joe Testa’s libgcrypt.def into the libgcrypt source directory. You can then build and strip the DLL with gcc -shared -o libgcrypt.dll libgcrypt.def src/.libs/libgcrypt.a /mingw/lib/libgpg-error.a and strip libgcrypt.dll
    4. Install it by copying libgcrypt.dll to /mingw/bin and /mingw/lib. Find the libgcrypt-config script and put that in /mingw/bin too (you’ll need it for compiling libgnutls later).

    That’s it – libgcrypt is done!

  5. zlib (compression)Get it via the mingwPORT section(you’ll need to either install wget or download the source tarball yourself – it’s pretty straightforward to figure out)
  6. libiconv – As with zlib, get this from mingwPORT
  7. libintl-0.14.4 (wide character support) – the libintl-2.dll can be downloaded from the GNUwin32 project. You then need to manually make the .la files by running the following multi-line commands (thanks to Wormux for the instructions).
    cat > /mingw/lib/ <<EOF
    # - a libtool library file
    # Generated by - GNU libtool fake
    cat > /mingw/lib/ <<EOF
    # - a libtool library file
    # Generated by - GNU libtool fake
  8. gnutls (TLS) – this compiles fine, but the documentation doesn’t. Just do make install at this point and the libraries will be installed, which is all you need.
  9. Optional: pdcurses (Text console library) – this is a straightforward compile (or just get the minGW binaries). – another straightforward compile.
  10. Optional: SDL (graphics library)
  11. pthreads (POSIX threads) – source and windows binaries

Step 3: Yet more build dependencies

Get ghc and happy from Haskell – you’ll have to install them outside your minGW path. Just get the windows binary build or this will take ages…

Edit the /etc/profile file in Msys to put GHC and Happy into your PATH, and restart MSys.

Step 4: Actually compiling Kaya!

If you’ve done all the above correctly, this final step is actually really easy…

Put the kaya distribution directory somewhere inside the MinGW tree, and run ./configure --prefix=c:/kaya (obviously you can have whatever prefix you like) and then make all test.

In theory, all of the tests except test019 should pass (test019 has a harmless failure on windows, to do with line-ending characters). If everything segfaults, it’s probably your libgc build. If only some tests fail, let us know so that we can investigate further.

Edit the /etc/profile in Msys to put c:/kaya/bin into your path and restart Msys again.

You can now use kayac via Msys!

Recent Comments

No comments to show.