author Nicolas Chauvat <>
Wed, 09 Sep 2009 19:28:59 +0200
changeset 468 c732fac8f916
parent 467 c66b74feb9d9
permissions -rw-r--r--
Bugfix: typo

Compiling rql for Windows

: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. 

The short way

Download and install

The long way

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. 

Dependencies installation

* cygwin_: download, run it and select the following

  - diffutils
  - perl
  - g++-mingw
  - some text editor of your choice (nano, vim...)

* mingw_: download the following files:

  - `gcc-g++-4.4.0-bin <>`_

  - `gcc-g++-4.4.0-dll <>`_

  - `gcc-core-4.4.0-bin <>`_

  - `gcc-core-4.4.0-dll <>`_

 - `gmp-4.2.4-dll <>`_

 - `mpfr-2.4.1-dll <>`_

 - `binutils-2.19.1-bin <>`_

 - `w32api-3.13-dev <>`_

  - `mingwrt-3.15.2-dev <>`_

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``

* download and untar `Gecode 3.1.0 source distribution <>`_.

Compiling gecode

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_CLOCK 1


  $ 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.

Compiling the C extension in rql

in a Windows shell (aka "DOS Console"), go the the rql directory and

 $ set PATH=%PATH%;c:\MinGW\bin;c:\MinGW\libexec\mingw32\4.4.0
 $ python build_ext -c mingw32 \
                             -Ic:\temp\gecode-3.1.0 \


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. 

.. _cygwin:
.. _mingw: