From Inkscape Wiki
Jump to navigation Jump to search

Static compilation of Inkscape is one way to sidestep dependency issues. Instead of requiring the user to install the particular versions of particular libraries, we just include them in the Inkscape binary.

Warning Will Robinson, this has a cost: The inkscape binary gets BIG. But that's the tradeoff we pay for gaining this convenience. From a packager's point of view it's also a bit more work, but this page will list out the steps to take achieve it. Of course, we'll still provide "regular" libs for people who are willing to get the dependencies in order, or who won't like downloading a huge package.


By static, we mean "all the nasty C++ and other new-fangled stuff". This is not a TRUE static binary. We are going to include only the items that we expect people may not have on their systems, and leave the more standard libraries dynamically linked.




Since you probably don't want to overwrite your existing versions of these libraries, put them somewhere other than /usr or /usr/local or /opt. For these examples, I'll use /extra/static. Since they depend on eachother, order is important. To have the builds see the new static libraries, you'll need to export these variables first:


(SuSE Linux users, add ":/opt/gnome/lib/pkgconfig/" to PKG_CONFIG_PATH above)

Unless noted, each of the libraries is built with:

 ./configure --disable-shared  --enable-static --prefix=/extra/static
 make install

List of support libraries to build statically first (they are used by the various libraries in the "Remaining" section below):

  • libpng 1.2.8+
    • Requires "cp scripts/makefile.linux Makefile" and to edit Makefile's "prefix" to /extra/static. Then a "make install-static" is all you need.
  • libjpeg 6b+
    • Requires a final "make install-lib"; recent versions perhaps not.
  • libxml 2.0+
  • libgc 6.4+
    • Some distros don't have this yet; in 6.3, edit os_dep.c, and replace the __libc_stack_end pragma/extern with "ptr_t __libc_stack_end = 0;" to get it to link. This may be fixed in new versions.

Libraries not needed, since they don't end up making anything useful. They're still listed here to retain their order, and to keep their weird configs for anyone else to play with in the future if pango can be convinced to work:

  • libexpat 1.95+
  • glib 2.0+
  • atk 1.0+
  • freetype 2.0+
  • xft 2.1+
  • fontconfig 2.2+
    • Remove "doc" and "test" from Makefile's SUBDIRS.
  • pango 1.0+
    • Ends up not working at all when built statically.
  • gtk+ 2.4+
    • Configure with "./configure --enable-static --disable-shared --without-libtiff --disable-modules --with-included-loaders=xpm,png,bmp,jpeg --prefix=/extra/static"
    • Remove "demos", "tests", and "perfs" from Makefile.
    • Remove remove "input" from SUBDIRS in modules/Makefile.
    • Needs -lz added after -lm everywhere in the gdk-pixbuf directory's Makefile for dealing with the static libpng.
    • If the process segfaults, try: CFLAGS="-O2 -mtune=i686 -pipe" ./configure [same as previous]

Remaining libraries to build statically:

  • libsigc++ 2.0+
    • Because C++ bindings ABI has changed several times, breaking Inkscape for several distros. edit Makefile to remove "docs" from SUBDIRS. (The mention of ABI breakage is a serious accusation, but the libsigc++ developers have never had any reports of it.
  • glibmm 2.4+
    • Because of C++ bindings
  • gtkmm 2.4+
    • Because of C++ bindings. Edit Makefile to remove "examples", "demos", and "tests" from SUBDIRS. You can also use --disable-examples and --disable demos, which are meant to speed things up.


If you're just building inkscape yourself, you can finally configure and build inkscape:

 ./configure ....

If you're building an RPM, you can build it with the existing inkscape.spec file. Two things need to happen:

  1. Build against the static tree you've made. Do this by adding "--define 'ink_static_root /extra/static'" to the rpmbuild command line.
  2. Disable automatic dep finding (since it doesn't work correctly for static binaries). Do this by creating ~/.rpmmacros with a line that reads "%__find_requires /path/to/script" and make that script look like this:
 cat >/dev/null

The resulting command line will be something along the lines of (can add "--target i686" for an i686-optimized version, too):

 rpmbuild -ta --nodeps inkscape-0.41.tar.gz --define 'ink_static_root /extra/static'

See also