Building Clutter for Windows

This page describes how to build Clutter for Windows using the MinGW compiler. If you were looking to build Clutter with Visual Studio instead there is an external project called HSBuild which is maintaining build files for Clutter and other GLib-based projects (see the HSBuild website here) though notably it can only build relatively old versions of Clutter (1.1.12 at time of writing). The PreBuild dll of Clutter 1.6.14 with MinGW on win32 can be found at clutter-win32

Cross-compiling using MinGW under Linux

Included in the Clutter source tree is a script called in the build/mingw directory which automates fetching of the dependencies required for cross compiling Clutter using the MinGW compiler. You can run it from Linux or using MSYS and MinGW run directly on Windows. (though the later hasn't been tested recently)

For cross compiling you need to have the compiler installed. The script should automatically download all other dependencies. Under Ubuntu (and probably other Debian-based distros) you can install the compiler with this command:

    $ sudo apt-get install mingw32{,-binutils,-runtime}

Under Fedora, you can install the compiler with this command:

    $ su -
    # yum install mingw32-binutils mingw32-runtime mingw32-gcc

To fetch the remaining dependencies run:

    $ cd clutter/build/mingw
    $ ./

and follow the prompts.

Now assuming your Root dir = /path/to/build/mingw/clutter-cross, your Build directory = /path/to/build/mingw/build and your mingw compiler target name is i586-mingw32msvc you should now be able to cross compile Clutter as follows:

    $ ./configure --host="i586-mingw32msvc" \
                  --target="i586-mingw32msvc" \
                  --build=\"`./config.guess`\" \
                  --enable-win32-backend \
                  --prefix=/path/to/build/mingw/clutter-cross \
                  CFLAGS="-mms-bitfields" \

    $ make

Note the --build option is often needed to force autoconf into realizing that it is cross-compiling. The wrapper is used to avoid inadvertently referencing system pkg-config files.

Building under MSYS on Windows

Building directly under Windows requires some extra work to get some basic utilities installed. Here are step-by-step instructions to build from a clean installation of Windows:

First you need to install the MinGW and MSYS packages from here.

Select the top package called ‘Automated MinGW Intaller’ and download the exe of the latest version. Run the executable and install to the default location. When asked to select components, be sure to tick the last box called ‘MinGW Developer ToolKit’ so that you'll also get MSYS. Make sure you DON'T install ‘MinGW make’ to make life easier.

To get the dependencies we want to run the script. However to do this we first need some extra utilities.

Make a directory called c:/mingw/msys/1.0/clutter-work and another directory called downloads under that. Go back to the SourceForge page for MinGW and select the ‘mingwPORT’ section. Download the wget tarball to the newly created downloads folder.

Start MSYS and type the following to install wget.

    cd /clutter-work/downloads
    tar -jvxf wget-1.9.1-mingwPORT.tar.bz2
    cp -v wget-1.9.1/mingwPORT/wget.exe /mingw/bin

Next we need to install unzip.exe which we can get from the GNUWin32 ports. Visit this page and download the ‘complete package, except sources’. Install it to the default location. On Windows 7 this will probably fail to install and you'll have to run the program again with the ‘recommended settings’ when it asks you.

Update your path to include unzip. On Windows 7 unzip will have been installed in "C:/Program Files (x86)" so please modify the PATH line accordingly. We also want to include the path for the root directory where we're going to install pkg-config and all of the DLLs that Clutter depends on.

    export PATH="$PATH:/c/Program Files/GnuWin32/bin:/clutter-work/clutter-cross/bin"

Next we need to install pkg-config. Type the following:

    cd /clutter-work/downloads
    wget ''
    mkdir /clutter-work/clutter-cross
    unzip -d /clutter-work/clutter-cross

Now we can type the following to download and install the Clutter dependencies using the helper script.

    cd /clutter-work
    wget -O downloads/ \
    MINGW_TOOL_PREFIX="/mingw/bin/" \
    sh ./downloads/

Press enter to all of the questions to get the default.

Now we need to get the Clutter source code. Grab the latest tarball from here and save it to the c:/mingw/msys/1.0/clutter-work/downloads directory. Extract it with the following:

    cd /clutter-work
    tar -zvxf downloads/clutter-$version.tar.gz
    cd clutter-$version

(where $version is the version you've downloaded)

Now we should finally be ready to compile Clutter. The --host parameter only needs to be passed because of a bug in the Clutter script. This should not be needed with the latest git version of Clutter.

    ./configure --enable-win32-backend \
                --prefix=/clutter-work/clutter-cross \
                --host=`./build/config.guess` \
    make all install

Now to prove that it worked we can run test-actors:

    cd tests/interactive
    ./test-interactive test-actors

If you want to compile a simple app without using autotools, it's easiest to use the libtool generated in the Clutter source so that it can work some voodoo with the included libraries. This assumes you've still got your path set up from the previous test:

    libtool --mode=link \
      gcc -Wall \
      `PKG_CONFIG_PATH=/clutter-work/clutter-cross/lib/pkgconfig pkg-config clutter-1.0 --cflags` \
      -I/clutter-work/clutter-cross/include \
      -g -o simple-app simple-app.c \
     `PKG_CONFIG_PATH=/clutter-work/clutter-cross/lib/pkgconfig pkg-config clutter-1.0 --libs`

Building with Visual Studio

You can follow the build instruction for building the GTK+ stack with Visual Studio; they include Clutter as well as its dependencies.

Sample Win32 Eclipse Workplace

To test Clutter on Windows it you can download an Eclipse CPP (Helios) Workplace that contains all needed win32 lib and configurations to run a clutter sample (circles) on windows.

You will need the MinGW compilator installed in C:\MinGW.

To install unzip the file and set the eclipse workplace folder to the archive root folder (workplace).

This workplace use the 12/16/2010 git version of Clutter that correspond to the 1.5.8 unstable release.

It can be use with an other version of Clutter by replacing the clutter_cross folder in testcircles by the newly compilated one.

Attic/ClutterBuildingForWindows (last edited 2015-05-25 12:46:00 by SvitozarCherepii)