Installing librsvg

apps

#1

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


#2

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.

  1. export PKG_CONFIG_PATH=$HOME/lib/pkgconfig
  2. Install glib >= 2.12.6
  3. Install atk >= 1.9.1
  4. Install cairo = 1.2.4 [color=#CC0000](Note: 1.2.6 appears to be broken; the configure script aborts with an error.)[/color]
  5. Install pango >= 1.14.8
  6. Download gtk+ >= 2.10.6 [color=#CC0000](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.)[/color]
  7. ./configure --prefix=$HOME --without-x --without-libtiff --with-gdktarget=linux-fb
  8. cd gdk-pixbuf
  9. make
  10. make install
  11. cp …/gdk-pixbuf-2.0.pc $HOME/lib/pkgconfig
  12. Install libcroco >= 0.6.1
  13. Install libgsf >= 1.14.3
  14. Install popt >= 1.7
  15. Download librsvg = 2.14.0 [color=#CC0000](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.)[/color]
  16. export CPPFLAGS=-I$HOME/include
  17. export LDFLAGS=-L$HOME/lib
  18. Install librsvg as usual now.
  19. Add the following to your MedaWiki LocalSettings.php file:
    $wgSVGConverter = ‘rsvg’;
    $wgSVGConverterPath = ‘/PATH/TO/YOUR/HOME/DIR/bin’;

#3

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


#4

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


#5

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


#6

Greetings, all.

I recently installed the latest version of librsvg (2.37.0) on our web host, since the old version was having problems with SVG files containing bitmaps. In doing so I found that the dependencies of librsvg have changed a lot in the last six years. The instructions posted in comment #2 above and in the wiki are out of date and utterly unusable. I have updated the wiki with a new set of instructions.

You can see librsvg in action on my website, where it’s invoked by MediaWiki to produce PNG thumbnails of SVG images: http://www.nothingisreal.com/autocomplete