[cairo] librsvg and cairo on Windows

Tor Lillqvist tml at iki.fi
Thu Oct 15 03:13:53 PDT 2009

> The librsvg website
> doesn't have a version that is easy to build on Windows, they all use
> makefiles, and I don't know how to use makefiles in Visual Studio.
> Also I didn't see anywhere that already compiled it to a dll and
> provided the headers in a nice development build of librsvg like the
> gtk site provides for cairo.

Check http://ftp.gnome.org/pub/gnome/binaries/win32/librsvg/2.26/ .

The librsvg DLL there depends on quite a bunch of other DLLs:
libcairo-2.dll, libgio-2.0-0.dll, libglib-2.0-0.dll,
libgobject-2.0-0.dll,  libgdk_pixbuf-2.0-0.dll, libcroco-0.6-3.dll,
libgsf-1-114.dll, libxml2-2.dll, libpango-1.0-0.dll and
libpangocairo-1.0-0.dll. And those then add dependency on
libfontconfig-1.dll, freetype6.dll, libpng12-0.dll and zlib1.dll.
Hopefully I got them all.

To get all these you need the corresponding packages from the same
site, i.e. cairo, glib, gtk+, libcroco, libgsf, libxml2, pango,
fontconfig, freetype, libpng and zlib. Hope I didn't miss any. Quite a
load, and I certainly admit that manually finding out what all you
need to download, and keeping a look for new versions as they are
released and built and provided, is a chore. Some kind of package
management would be nice.

There is no .lib (import library) for librsvg there, though. But it is
relatively trivial to build one such yourself: run link -dump -exports
on the DLL and edit the output into a .def file. (The librsvg API is
luckily a purely functional one, as far as I know, no pesky DATA
exports involved.) Then run lib on the .def file to produce a .lib
file, i.e. import library. How to do this should be explained in the
Microsoft documentation.

It might also work to just copy the librsvg-2.dll.a to rsvg-2.lib
(that would be the logical name for it I think). As far as I know the
import library format produced by the GNU ("mingw") tool-chain is
usable also by Microsoft's tools. (Not necessarily the other way
around, though. If one uses newer versions of Microsoft's tool-chain
to produce a .lib import library I think that one can't use that .lib
import library with GNU ld.) (And this is for an API that is plain C;
for C++ one cannot mix compilers, and that is intentional.)


More information about the cairo mailing list