Installing librsvg

Installing librsvg

Posted by: Psychonaut
Posted on: 2007-01-01 11:59:00

I'm trying to install librsvg, a Gnome SVG library which is used by MediaWiki to convert SVG graphics to bitmaps for browsers which do not yet support SVG. (The default SVG to bitmap conversion utility, ImageMagick, is already available on DreamHost, but it makes a royal mess of most SVG files.)

I'm running up against a lot of unmet dependencies, even when disabling all of the optional features with the ./configure script. Has anyone succesfully installed librsvg in their home directory? Or failing that, has anyone successfully built a statically linked version of rsvg-convert which I could use? (I tried making a statically linked version on my home machine with ./configure --disable-shared --enable-static, but it still left out a few libraries, such as libgsf.)

The latest version of librsvg can be found here:
http://ftp.gnome.org/pub/GNOME/sources/librsvg/2.16/librsvg-2.16.1.tar.bz2


Re: Installing librsvg

Posted by: Psychonaut
Posted on: 2007-01-01 15:42:00

I finally managed to figure out how to do this. It took a lot of work, mostly because of various bugs and undocumented package dependencies. In case anyone else wants proper SVG support for their MediaWiki installation, here are the steps you need to follow. (I assume you are familiar with basic source tarball installation under Linux.) Unless otherwise noted, all packages can be configured with simply --prefix=$HOME.

0. export PKG_CONFIG_PATH=$HOME/lib/pkgconfig
1. Install glib >= 2.12.6
2. Install atk >= 1.9.1
3. Install cairo = 1.2.4 (Note: 1.2.6 appears to be broken; the configure script aborts with an error.)
4. Install pango >= 1.14.8
5. Download gtk+ >= 2.10.6 (Note: You will not be able to install the full gtk+ package; the default target depends on X libraries and headers, which are not installed on DreamHost, and the linux-framebuffer target is unmaintained and doesn't compile. However, all librsvg needs is gdk-pixbuf, which thankfully can be compiled and installed separately, with a little trickery.)
6. ./configure --prefix=$HOME --without-x --without-libtiff --with-gdktarget=linux-fb
7. cd gdk-pixbuf
8. make
9. make install
10. cp ../gdk-pixbuf-2.0.pc $HOME/lib/pkgconfig
11. Install libcroco >= 0.6.1
12. Install libgsf >= 1.14.3
13. Install popt >= 1.7
14. Download librsvg = 2.14.0 (Note: Do not use 2.16.1, as it is buggy and produces terrible output on certain SVG files. However, the 2.14.0 configure script isn't smart enough to find popt, so we need to manually set some environment variables first.)
15. export CPPFLAGS=-I$HOME/include
16. export LDFLAGS=-L$HOME/lib
17. Install librsvg as usual now.
18. Add the following to your MedaWiki LocalSettings.php file:
$wgSVGConverter = 'rsvg';
$wgSVGConverterPath = '/PATH/TO/YOUR/HOME/DIR/bin';


Re: Installing librsvg

Posted by: tyam
Posted on: 2007-01-12 21:58:00

We tried doing this over on one of my domains a while back with no luck. So I decided to try your way. I get stuck here:
&& echo timestamp > s-enum-types-h
/bin/sh: line 1: glib-mkenums: command not found
make[2]: *** [s-enum-types-h] Error 127

It's pulling from
s,@GLIB_MKENUMS@,($HOME)/bin/./glib-mkenums,;t t

which if just run at bash (if unedited) will call the script just fine. So I have no idea what the issue is and I've spent about 3 hours trying everything I can think of with no luck. :[

Re: Installing librsvg

Posted by: Psychonaut
Posted on: 2007-01-13 09:25:00

Do you have your home bin directory in your path? Try
export PATH=$HOME/bin:$PATH

Re: Installing librsvg

Posted by: Atropos7
Posted on: 2009-07-30 23:24:00

// This is not for the inexperienced cool

I wanted to convert SVG images to PNG myself recently. I found this post with instructions for installing librsvg. I just went through the process tonight and tried to install some of the new versions that have come out. I tried to install a newer version of Cairo and it said it was dependent on librsvg. And newer GTK versions will fail instead of warn about linux-framebuffer.

I've added the instructions to Wiki: http://wiki.dreamhost.com/Installing_librsvg

Don't try Batik, which is a resource-hungry Java implementation. Well it works fine from your own computer but it will get killed on shared servers. Have to watch out for SVG files using 1.2 feautes but specify version 1.0 instead.


Customer since 2000 cool openvein.org

Tags: dreamhostimagemagickmediawikihome directorylibraries