Difference between revisions of "Compiling Inkscape"

From Inkscape Wiki
Jump to navigation Jump to search
m
m (moved CompilingInkscape to Compiling Inkscape: kill wikiwords)
(39 intermediate revisions by 12 users not shown)
Line 10: Line 10:
= Notes =
= Notes =
Inkscape needs automake1.7 or automake1.8 to compile NOT automake1.9 it has a bug ( link: http://sourceforge.net/mailarchive/message.php?msg_id=10288631 ) that prevents compiling of Inkscape. If you have already tried to do a $ make with automake1.9 then $ ./autogen.sh from your inkscape-cvs dir and proceed as normal.
Inkscape needs automake1.7 or automake1.8 to compile NOT automake1.9 it has a bug ( link: http://sourceforge.net/mailarchive/message.php?msg_id=10288631 ) that prevents compiling of Inkscape. If you have already tried to do a $ make with automake1.9 then $ ./autogen.sh from your inkscape-cvs dir and proceed as normal.
(On the other hand, I've repeatedly built it with automake-1.9.4.  ralf)


You may want to also [http://wiki.inkscape.org/wiki/index.php/OtherProjects#Inkscape_Plugins.2C_Scripts.2C_and_Templates add plugins] during or after compiling.


= OS & Distribution Specific =
= OS & Distribution Specific =
* '''Linux'''
* '''Linux'''
** [[CompilingAutopackage|Autopackage]] (multi-distro)
** [[CompilingFedora|Fedora]]
** [[CompilingFedora|Fedora]]
** [[CompilingGentoo|Gentoo]]
** [[CompilingGentoo|Gentoo]]
** [[CompilingDebian|Debian]]
** [[CompilingDebian|Debian]]
** [[CompilingUbuntu|Ubuntu]]
** [[CompilingYellowDog|Yellow Dog]]
** [[CompilingYellowDog|Yellow Dog]]
** [[CompilingSuse|Suse]]
** [[CompilingSuse|Suse]]
Line 27: Line 31:
* [[CompilingSunSolaris|Sun Solaris]]
* [[CompilingSunSolaris|Sun Solaris]]
* [[CompilingStatic|Static Compiles]]
* [[CompilingStatic|Static Compiles]]


= Package Config (pkg-config) =
= Package Config (pkg-config) =
Line 42: Line 45:


for bash:
for bash:
     export PKG_CONFIG_PATH=/usr/local/bin/pkgconfig:/usr/lib/pkgconfig
     export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig
for csh:
for csh:
     setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/pkgconfig
     setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/pkgconfig


A good place to put this line is in your .bashrc or .cshrc file
A good place to put this line is in your .bashrc or .cshrc file


= Getting and Installing Source packages =
= Getting and Installing Source packages =
Line 73: Line 75:
* As the 'root' user,  install it with:
* As the 'root' user,  install it with:


     $ make install
     # make install


== Boehm-GC ==
== Boehm-GC ==


Source: http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc6.4.tar.gz
Source: http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source
 


[Note that for old 0.40CVS development versions we used the C++ version of gc, so you need to compile it with the --enable-cplusplus; we didn't include that version in any of the official releases though.]
*  Download this file:
**  http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc6.8.tar.gz
*  Unpack it
**  tar zxf gc6.8.tar.gz
*  Configure and build it
**  cd gc6.8
**  ./configure --disable-shared --enable-static
**  make
*  Install it
**  su    (or however else you become root)
**  make install


Also, if searching for a package for GC, the name of it is sometimes:
Binaries:  If searching for a package for GC, the name of it is sometimes:


* gc
* gc
* libgc
* libgc
* gc-devel
* libgc-devel
* libgc-devel
* boehm-gc  (on Gentoo)
* boehm-gc  (on Gentoo)
 
* debian/ubuntu:  sudo apt-get install libgc-dev


== libSigc++ ==
== libSigc++ ==


Source: http://sourceforge.net/project/showfiles.php?group_id=1970&package_id=76644
Source: http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.2/libsigc++-2.2.3.tar.bz2


With this file, and for GlibMM and GtkMM below, it is usually desirable for us developers to
With this file, and for [[GlibMM]] and [[GtkMM]] below, it is usually desirable for us developers to
build this C++ library statically.  This removes a dependency that might be difficult for an
build this C++ library statically.  This removes a dependency that might be difficult for an
end-user during installation.  Configure it with:
end-user during installation.  Configure it with:
Line 100: Line 112:
     ./configure --enable-static --disable-shared
     ./configure --enable-static --disable-shared


== [[GlibMM]] ==
Try to match your Glib2 version with GlibMM's version. For example, if your Glib2 is 2.16.6, download glibmm-2.16.4.tar.bz2.


== GlibMM ==
Latest source: http://ftp.gnome.org/pub/GNOME/sources/glibmm/


Source: http://ftp.gnome.org/pub/GNOME/sources/glibmm/2.4/
== [[GtkMM]] ==
Usually you can try the latest version of GtkMM, but if you get version mismatch errors, try older releases.


== GtkMM ==
Source: http://ftp.gnome.org/pub/GNOME/sources/gtkmm/2.12/gtkmm-2.12.7.tar.bz2


Source: http://ftp.gnome.org/pub/GNOME/sources/gtkmm/2.4/
== cairomm ==


if you got prompted about cairomm, try first solve your cairo version, so you can grab [http://www.cairographics.org/releases/ there] a compatible version.




== Boost ==


Many users have reported when building from source that after installing the above dependencies, the configure script still requires a "boost" package. It can be found below, but even after installing, you will need to create a symlink to allow the configure script to find it:


'''ln -s /usr/local/include/boost_1_xx_x/boost /usr/local/include/boost'''
Source: http://www.boost.org/users/download/
== Poppler ==
Source: http://poppler.freedesktop.org/
Note: there seems to be an incompatibility with recent versions of poppler. See the following bugreport: https://bugs.launchpad.net/inkscape/+bug/254849
Also, the <code>-DPOPPLER_NEW_GFXFONT</code> hack does not seem to work with vanilla 0.46, you should obtain a snapshot version instead.
One of the mentioned compilation errors is due to a mis-configured Poppler build/install - you will see the following errors:
<pre>In file included from extension/internal/pdfinput/svg-builder.cpp:19:
extension/internal/pdfinput/svg-builder.h:32:23: error: CharTypes.h: No such file or directory
...
make[2]: *** [extension/internal/pdfinput/svg-builder.o] Error 1
make[2]: Leaving directory `/tmp/build/inkscape-0.46/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/build/inkscape-0.46'
make: *** [all] Error 2</pre>


= Developer Compilation =
= Developer Compilation =
Line 138: Line 178:
  cd ../build-g++
  cd ../build-g++
  CXXFLAGS='-g -O0 -Wall' CXX='ccache g++' ../inkscape/configure
  CXXFLAGS='-g -O0 -Wall' CXX='ccache g++' ../inkscape/configure
  cd build-gcc && make -j 3
  cd ../build-gcc && make -j 3
  cd build-g++ && make -j 3
  cd ../build-g++ && make -j 3




Turning off just optimization (which can produce strange results in debuggers):
Turning off just optimization (which can produce strange results in debuggers):


export CC=g++
  export CXXFLAGS='-g -O0 -Wall'
  export CXXFLAGS='-g -O0 -Wall'
  export CFLAGS='-g -O0 -Wall'
  export CFLAGS='-g -O0 -Wall'
  ./configure
  ./configure
See [[TestingInkscape]] for information on building and executing (unit) tests.
[[Category:Developer Documentation]]

Revision as of 15:48, 19 June 2009

Hopefully, Inkscape will compile right out of the box. If it doesn't, well that's what this page is for.

Jot down notes, questions, findings, tips, etc. here on things you run into. It's a good idea to make mention of what version of the code you're trying to compile, the distribution you're running, and other such information that might be pertinent.

If legitimate bugs are found or patches developed, please move them to the tracker at Sourceforge rather than inlining them here.

Notes

Inkscape needs automake1.7 or automake1.8 to compile NOT automake1.9 it has a bug ( link: http://sourceforge.net/mailarchive/message.php?msg_id=10288631 ) that prevents compiling of Inkscape. If you have already tried to do a $ make with automake1.9 then $ ./autogen.sh from your inkscape-cvs dir and proceed as normal. (On the other hand, I've repeatedly built it with automake-1.9.4. ralf)

You may want to also add plugins during or after compiling.

OS & Distribution Specific

Package Config (pkg-config)

If you must compile and install any of these from source, you may find an error like this when trying to compile them or Inkscape itself:

checking for gtk+-2.0 >= 2.0.0  libxml-2.0 >= 2-2.4.24  sigc++-1.2  gtkmm-2.0... Package gtkmm-2.0 was not found in the  pkg-config search path.
Perhaps you should add the directory containing `gtkmm-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtkmm-2.0' found

A solution is to set the PKG_CONFIG_PATH variable as so:

for bash:

    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig

for csh:

    setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/pkgconfig

A good place to put this line is in your .bashrc or .cshrc file

Getting and Installing Source packages

If your distro does not have some packages available (like many don't, ie, Fedora Core 2), you must often download source packages and build and install them yourself. Actually this is not that hard, and is similar to doing a Gentoo 'emerge.'

  • Usually you download a file with a name like somepackage-1.0.tar.gz. Unpack it with
   $ tar zxf somepackage-1.0.tar.gz
   or
   $ tar jxf somepackage-1.0.tar.bz2
  • Then 'cd' into the new directory.
  • Configure it with the command:
   $ ./configure
  • Build it with:
   $ make
  • As the 'root' user, install it with:
   # make install

Boehm-GC

Source: http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source

Binaries: If searching for a package for GC, the name of it is sometimes:

  • gc
  • libgc
  • gc-devel
  • libgc-devel
  • boehm-gc (on Gentoo)
  • debian/ubuntu: sudo apt-get install libgc-dev

libSigc++

Source: http://ftp.gnome.org/pub/GNOME/sources/libsigc++/2.2/libsigc++-2.2.3.tar.bz2

With this file, and for GlibMM and GtkMM below, it is usually desirable for us developers to build this C++ library statically. This removes a dependency that might be difficult for an end-user during installation. Configure it with:

   ./configure --enable-static --disable-shared

GlibMM

Try to match your Glib2 version with GlibMM's version. For example, if your Glib2 is 2.16.6, download glibmm-2.16.4.tar.bz2.

Latest source: http://ftp.gnome.org/pub/GNOME/sources/glibmm/

GtkMM

Usually you can try the latest version of GtkMM, but if you get version mismatch errors, try older releases.

Source: http://ftp.gnome.org/pub/GNOME/sources/gtkmm/2.12/gtkmm-2.12.7.tar.bz2

cairomm

if you got prompted about cairomm, try first solve your cairo version, so you can grab there a compatible version.


Boost

Many users have reported when building from source that after installing the above dependencies, the configure script still requires a "boost" package. It can be found below, but even after installing, you will need to create a symlink to allow the configure script to find it:

ln -s /usr/local/include/boost_1_xx_x/boost /usr/local/include/boost

Source: http://www.boost.org/users/download/

Poppler

Source: http://poppler.freedesktop.org/

Note: there seems to be an incompatibility with recent versions of poppler. See the following bugreport: https://bugs.launchpad.net/inkscape/+bug/254849

Also, the -DPOPPLER_NEW_GFXFONT hack does not seem to work with vanilla 0.46, you should obtain a snapshot version instead.

One of the mentioned compilation errors is due to a mis-configured Poppler build/install - you will see the following errors:

In file included from extension/internal/pdfinput/svg-builder.cpp:19:
extension/internal/pdfinput/svg-builder.h:32:23: error: CharTypes.h: No such file or directory
...
make[2]: *** [extension/internal/pdfinput/svg-builder.o] Error 1
make[2]: Leaving directory `/tmp/build/inkscape-0.46/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/build/inkscape-0.46'
make: *** [all] Error 2

Developer Compilation

Plain vanilla compilation is done as documented in INSTALL; ./autogen.sh (optionally); ./configure; make; su && make test; make install (optional). See INSTALL for more on that.

But if you're going to be doing a lot of development, there's some tricks and techniques you should know, to get best results.

  1. Turn off optimization
  2. Use ccache for faster compilation
  3. Set up a separate build directory (nice for testing both gcc and g++, or cross compiling)
  4. Use the -j N flag to optimize for the number of processors in your machine, with N = 1 + no. proc's

Example: Setting up both gcc and g++ build environments (in separate tree), and using ccache for faster compilations on a dual-processor machine, with no optimization, assuming /bin/bash:

mkdir build-gcc build-g++
cvs checkout inkscape
cd inkscape
libtoolize --copy --force
./autogen.sh
cd ../build-gcc
CFLAGS='-g -O0 -Wall' CC='ccache gcc' ../inkscape/configure
cd ../build-g++
CXXFLAGS='-g -O0 -Wall' CXX='ccache g++' ../inkscape/configure
cd ../build-gcc && make -j 3
cd ../build-g++ && make -j 3


Turning off just optimization (which can produce strange results in debuggers):

export CXXFLAGS='-g -O0 -Wall'
export CFLAGS='-g -O0 -Wall'
./configure

See TestingInkscape for information on building and executing (unit) tests.