author: | Alexandre Fayolle |
---|---|
date: | 2009/09/09 |
RQL can use either logilab.constraint or gecode to perform type inference. This document explains how the gecode support can be added for the Windows platform.
Download and install http://ftp.logilab.org/pub/rql/rql-0.23.0.win32-py2.5.exe
Problem statement: we want to use python2.5 on windows. Compiling C extensions requires Visual Studio 2003, but Gecode requires Visual Studio 2008. So we are stuck with using MinGW, and then again Gecode requires gcc 4.2 or later and cygwin to support building. But cygwin doesn’t come with a mingw enabled gcc 4.x (only 3.x available), so some stiching is required.
Create c:\MinGW
. Launch a cygwin shell, go to /cygdrive/c/MinGW
and
untar all the mingw tarballs
Edit /etc/profile
and go to the place where the PATH
environment
variable is set. Change the line to prepend
/cygdrive/c/MinGW/bin:/cygdrive/c/MinGW/libexec/mingw32/4.4.0
to the PATH
In a cygwin shell, go the the untarred Gecode source directory and run:
$ ./configure --enable-version-specific-runtime-libs \
--disable-shared --disable-qt --disable-gist \
--disable-examples --enable-static
Edit gecode/support/config.hpp, and change the line
#define GECODE_USE_GETTIMEOFDAY 1
to:
#define GECODE_USE_CLOCK 1
run:
$ make CXXFLAGS="-I. -O1 -DNDEBUG -Wextra -Wall -pipe -ggdb \
-fno-strict-aliasing -ffast-math -mthreads -DGECODE_BUILD_SUPPORT -static-libgcc"
While this runs, consider renting some Bollywood movie (I enjoyed this one) and watching it.
in a Windows shell (aka “DOS Console”), go the the rql directory and run:
$ set PATH=%PATH%;c:\MinGW\bin;c:\MinGW\libexec\mingw32\4.4.0
$ python setup.py build_ext -c mingw32 \
-Ic:\temp\gecode-3.1.0 \
-Lc:\temp\gecode-3.1.0
--in-place
Open a new console (to get the default PATH
). Go to the parent
directory of rql. Launch the Python interpreter, and type:
>>> import rql.analyze
If this works, congratulation, you’re done.