Saturday, February 16, 2008

Installing MEEP on CYGWIN

Well, after finding no online tutorial that explains how one can install MEEP on WinDoze using Cygwin, and being unable to edit the MEEP wiki page, I am posting this here.


On your windoze workstation, first install Cygwin. I used the cygwin setup to install all available packages which took a hefty few GB. 
MEEP installation then pretty-much follows the original instructions,  except for a few changes that could save major headaches later!

Create a folder MEEP in /home/username (where username is your current Windows login username) and download and extract all .tar.gz files here. 

Compile and install BLAS, LAPACK. There is apparently something wrong with Cygwin's libtool repository. So MEEP won't compile unless the fix below is applied before installing harminv:

Change the last line in your /usr/lib/gcc/i686-pc-cygwin/3.4.4/libg2c.la 
from
    libdir='/usr/lib/gcc/i686-pc-cygwin/'
to
    libdir='/usr/lib/gcc/i686-pc-cygwin/3.4.4'
Now compile and install harminv, Guile, libctl and HDF5.

In order to avoid an error message about an undefined 'timezone' variable while compiling HDF5 (see here), you may want to configure HDF5 as follows (thanks to Mark Hadfield):
CC=gcc CFLAGS=-ansi ./configure --prefix=/usr/local
make

Now compile and install HDF5, and finally of course MEEP (hopefully, it works?).

But then, Meep installation will fail as the HDF guys (NCSA) changed the programming interface incompatibly in HDF5 ver 1.8. For example, the prototype for the H5Eget_auto function changed and this causes compilation of Meep to fail.

Thanks to the workaround from Steven Johnson, Meep successfully installs by configuring it as:
./configure CPPFLAGS="-DH5_USE_16_API"

Although, I am having trouble doing 'make check' on Meep. This fails with the error:
> bragg_transmission.cpp: In function `double distance_from_curve(int, double, double*, double, double)':
> bragg_transmission.cpp:186: error: `infinity' undeclared (first use this function)
> bragg_transmission.cpp:186: error: (Each undeclared identifier is reported only once for each function it appears in.)

Apparently,  INFINITY is originally declared in meep.hpp and so, if you hardwire INFINITY to be 1e-20 in the bragg_transmission.cpp, which is it's usual definition in MEEP, it may work.

No comments: