[cairo] crosscompiling cairo with mingw64

Maarten Bosmans mkbosmans at gmail.com
Thu Sep 22 12:29:42 PDT 2011

It's really not that difficult. Can you describe more precisely what
problems you're encountering?

You should also compile the dependencies with the same toolchain. From
the top of my head the minimal set is pixman, libpng, zlib.

The configure script should take care of it all (however, I think the
libpng and zlib scripts aren't autotools based, so crosscompiling
could be a bit more difficult). The main trick is to keep the
cross-compilation toolchain and build software separate from the build
host's binaries.

This is the script I use to run configure in a source tree. It sets
all the variables needed for mingw cross-compilation.

echo "lt_cv_deplibs_check_method='pass_all'" >> mingw32.cache
PKG_CONFIG_LIBDIR=/usr/local/mingw/lib/pkgconfig/ \
CFLAGS=-I/usr/local/mingw/include                 \
CPPFLAGS=-I/usr/local/mingw/include               \
LDFLAGS=-L/usr/local/mingw/lib                    \
./configure \
  --disable-static --enable-shared \
  --host=i586-mingw32msvc --build=i686-linux \
  --prefix=/usr/local/mingw --cache-file=mingw32.cache \

Obviously, you need to change the toolchain prefix given to --host to
your specific triplet. The *FLAGS pointing to /usr/local/mingw/* is a
bit of a hack, but needed for packages that don't support pkg-config
properly. Also note usage of PKG_CONFIG_LIBDIR instead of
PKG_CONFIG_PATH to avoid picking up packages from the build host.


2011/9/22 kees de jong <omekeesje at ziggo.nl>:
> Many thanks to all who tried to help me!
> After reading your mails, I have again tried to compile cairo
> with mingw64, incorporating some of your remarks.
> I think now, after having done a lot of trials with several different
> configure options, that the combination mingw64 and cairo as for now
> is not possible, unless you are willing to spend a lot of time doing
> things that I expected configure to do.
> So I say farewell to cairo for the time being.
> As I only need a simple 2d drawing library to display the results
> of certain calculations, maybe cairo is overkill.
> I tried already GTK+ , as that is the library I work with on linux,
> but could not compile that either (of course because it depends
> on cairo).
> Maybe somebody can give me a hint about a free and simply to build
> 2d graphics library???
> Kees de Jong
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

More information about the cairo mailing list