Compiling Inkscape

From Inkscape Wiki
Revision as of 09:11, 1 September 2004 by 211.222.247.120 (talk)
Jump to navigation Jump to search

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.

OS & Distribution Specific

  • Linux
    • CompilingFC2
    • CompilingGentoo
    • CompilingDebian
    • CompilingYellowDog
  • CompilingMacOsX
  • Windows Win32Port [Windows Win32Port]
  • CompilingSPARC
  • CompilingSunSolaris


Specific Package Problems + Solutions

GtkMM

If you have to compile and install GtkMM from source, you may find an error like this when trying to compile Inkscape:

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 suggested by Ishmal is to set the PKG_CONFIG_PATH variable as so:

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



Boehm Garbage Collector Dependency

If your distro does not have a package available (like many don't, ie, Fedora Core 2), then download source from here:

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

Then configure it with the command:

  $ ./configure --enable-cplusplus
  $ make; make install


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

  • gc
  • libgc
  • libgc-devel
  • boehm-gc (on Gentoo)


OSX

You can run Inkscape by compiling by using Fink. http://fink.sourceforge.net

It's as simple as: #fink -y install inkscape

Fink will get all the dependencies and install them.


Compiling Inkscape under Mac OS X

To get autogen to run I had to perform the following ( Assuming users have fink installed )

sudo fink install gtk+ ( which installs gtk+ and gtk+2 ) sudo fink install libtool14 ( replacing apple's glibtoolize )

These entries are all to be put in your ~/.cshrc ( or applicable shell startup )

setenv ACLOCAL_FLAGS "-I /sw/share/aclocal"
setenv CFLAGS -I/sw/include


setenv LDFLAGS -L/sw/lib
setenv CXXFLAGS $CFLAGS
setenv CPPFLAGS $CXXFLAGS

--

For a clean 10.3 installation with a brand new Fink, I had to add the following:

  • intltool
  • glib2
  • glib2-dev
  • libpng3
  • libart2
  • libxml2
  • gtk+2
  • gtk+2-dev

In theory you can just list all those on one install command. -- JonCruz

Apart from the above env variables I had to set the following variables to compile cvs (taken right out of fink's .info file). This is in bash syntax, above is tcsh syntax. (I havent experimented with this list to see whats the minimum required.. but if I dont include any of the following than it breaks.)

export ACLOCAL_FLAGS="-I /sw/share/aclocal"
export CFLAGS=-I/sw/include
export LDFLAGS=-L/sw/lib
export CXXFLAGS=$CFLAGS
export CPPFLAGS=$CXXFLAGS
export LIBRARY_PATH=/usr/X11R6/lib:/sw/lib
export CPATH=/sw/include
export PATH="/usr/X11R6/bin:"$PATH
export LIBS="-L/sw/lib -lintl "$LIBS

Update: There is a problem with rendering cursors on mac due to a gcc bug. At this point fink is maintaining an inkscape package and they are going to use a patch to fix it for 0.38.1 so I recommend fink package. If you are interested in patching yourself, visit tracker item 932944 at https://sourceforge.net/tracker/index.php?func=detail&aid=932944&group_id=93438&atid=604306 .

-- Spundun

since gtkmm-2.0 has been added as a requirement, you may need to install it thru darwinports; to use it along whatever you installed with fink prior to that, the flags are:

export ACLOCAL_FLAGS="-I /sw/share/aclocal"
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/local/lib/pkgconfig/
export LDFLAGS="-lintl -L/sw/lib -L/opt/local/lib"
export CFLAGS="-I/sw/include -I/opt/local/include"
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS

-- yafosf

If you need to run "./autogen.sh":

fink install automake1.8 autoconf2.5

Otherwise:

fink install �
       intltool �
       glib2 glib2-dev glib2-shlibs �
       gtk+2 gtk+2-shlibs gtk+2-dev �
       libpng3 libpng3-shlibs �
       libtool14 libtool14-shlibs �
       libpng-shlibs �
       libsigc++12 libsigc++12-shlibs �
       popt popt-shlibs 
export CPPFLAGS=-I/sw/include
export LDFLAGS=-L/sw/lib
# Run ./autogen.sh here if things break below...
./configure --prefix=/sw
echo "#define ENABLE_NLS" >> config.h
make
make install


-- Kees Cook

Linux

Fedora Core 2 for Inkscape 0.40CVS

After having the most up to date RPMs for FC2 from fedora updates, this is what I found for compiling Inkscape.

Well...after checking out a clean copy of the inkscape module, autogen.sh will not generate ltmain.sh, so I had to make a softlink to a copy of ltmain.sh, which was located here: /usr/share/libtools/ltmain.sh

So I ran:

  $ ln -s /usr/share/libtools/ltmain.sh ./

Then I ran:

  $ ./autogen.sh


Then to get all the makefiles, I ran:

  $ ./configure

Now need to have Boehm Garbage collector installed. Follow the Boehm Garbage Collector instructions above for this to work. After installed, then rerun:

  $ ./configure

For libsigc++2 currently you must download and install: http://sourceforge.net/project/showfiles.php?group_id=1970

Now you need gtkmm 2.4 and glibmm 2.4:

http://ftp.gnome.org/pub/GNOME/sources/glibmm/2.4/

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


You need to ./configure; make; make install for libsigc++, glibmm 2.4 and gtkmm 2.4

Afterwards update your paths and all that and then run ./autogen.sh; ./configure; make; make install on the CVS version of inkscape...



YELLOWDOG Linux 3.0

It's pretty straight forward as with most of the current distributions.

First of all, unpack the latest inkscape.tar.gz:

$ tar zxvf inkscape-0.35-pre0.tar.gz

Try to ./configure and find out that you need libpng.
Next try to understand that although `yum install libpng' says that you have the latest working version for your system, you still cannot get InkScape to compile (the reason is that you need libpng-devel for this.)
Since there is no Yellowdog RPMs for libpng-devel, go to http://www.libpng.org/ and download the latest tarball (1.2.5 works fine), ./configure, make, and make install.
Go back to your InkScape source directory and re./configure.
InkScape will happily compile now!

-- Daniel D�az

Gentoo Linux

If it doesn't build, try installing libtool. If that doesn't work then try installing the gentoo equivalents of the following Debian packages (from debian/control, in alphabetical order):

 Build-Depends: automake1.7, debhelper (>= 4.0.0), gettext, intltool,
   libart-2.0-dev (>= 2.3.10), libatk1.0-dev, libfreetype6-dev, libgc-dev,
   libglib2.0-dev, libgtk2.0-dev (>= 2.0.6-1), libgtkmm-2.4-dev,
   libpango1.0-dev, libpng12-dev, libpopt-dev, libsigc++-2.0-dev, libtool,
   libxft2-dev, libxml-parser-perl, libxml2-dev (>= 2-2.4.24), pkg-config,
   xlibs-dev, zlib1g-dev

To get the 2.4 version of gtkmm:

emerge sync
ACCEPT_KEYWORDS="~x86" emerge gtkmm

Gentoo CVS Ebuild ready !

Hi there,

This afternoon I decided to make an ebuild for the CVS of inkscape for gentoo users !

To use it:

You can improve it and send me back the modifications and I'll update the file.

I need feedback !

Here is my jabber id: pol@amessage.de
Here is my e-mail : blenderman _at_ tiscali _dot_ be

Cya

-Dell'Aiera Pol-

-- Annotation: You need an installed gtkmm-2.2 (2.4 does not work currently), Dominic

Note that the Gentoo packagename for the Boehm garbage collector Inkscape requires is boehm-gc. Unfortunately, this was set up without --enable-cplusplus. You can manually get it to work, though: See http://www.gentoo.org/doc/en/faq.xml#configure and follow the steps. After installing it this way, I also had to do `chmod a+rx /usr/include/gc` so Inkscape's ./configure will find the headers

Also, gentoo includes libsigc++ 2.0.1, but Inkscape requires 2.0.3, so that has to be manually installed.

Sparc

I didn't change anything. The configure-line used in debian/rules is CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info This is mainly from dh_make.

-- Wolfram Quester

Suse 9.0

One of the challenges with Suse 9.0 is the lack of a distro provided gtkmm2 and libsigc++ packages.

Best place to find them: ftp://ftp.gwdg.de/pub/linux/misc/apt4rpm/suse/usr-local-bin/9.0/

Suse 9.1 includes both now in the GNOME supplemental downloads.

Note that for SuSE the gtk+2 packages are called gtk2. The gtk+2 2.4 package is not provided via Yast but can be found via rpmseek as gtk2 and gtk2-devel

To find the .pc files, I had to set:

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

In SuSE 9.1 I ran into this error:

  configure.in:25: required file `./ltmain.sh' not found

Copying /usr/share/libtool/ltmain.sh into the top directory fixed it.

For 0.40cvs the libgc dependency is added. In SuSE 9.1 this is package 'boehm-gc', but it doesn't work - you need to compile from source. Download from:

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

Then configure it with the command:

  $ ./configure --enable-cplus-plus

SuSE 9.1 also does not have libsigc++ 2.0; I couldn't find an rpm for it so ended up having to compile it from source, from http://prdownloads.sourceforge.net/libsigc/libsigc++-2.0.3.tar.gz

I also had to compile gtkmm 2.4 and glib 2.4 from source; download them from ftp://ftp.gnome.org/pub/GNOME/sources/gtkmm/2.4/ and http://ftp.gnome.org/pub/GNOME/sources/glibmm/2.4/

Looks like these packages are also available from here:ftp://ftp.gwdg.de/pub/linux/suse/apt/SuSE/9.1-i386/RPMS.gnome/

Also, stuff got installed to /opt/gnome/bin/, so I had to also `export PATH=$PATH:/opt/gnome/bin/`

Debian Testing

To get things to compile I found I needed the packages libtool, libgtk2.0-dev, libglib2.0-dev and automake1.7

Slackware 10

Had a problem with the configure script of inkscape not finding my installed libsigc++ setting the system variable as follows did the trick:

export PKG_CONFIG_PATH /usr/local/lib/pkgconfig

where the config file sigc++-1.2.pc was installed in /usr/local/lib/pkgconfig/sigc++-1.2.pc which if found using: locate sigc++ |grep pc

--Luke Munholand

<a href="http://Yoper.com">Yoper</a>

This has been tested for Inkscape0.39 on Yoper i686-2.1.0-4:

  1. review the <a href="http://www.yoper.com/forum2/index.php?showtopic=800">Guide to Compiling Software from Source</a>
  2. compile <a href="http://prdownloads.sourceforge.net/libsigc/libsigc%2B%2B-1.2.5.tar.gz?download">libsigc++-1.2.5.tar.gz</a>
  3. Run ldconfig as root so the library can be found by the OS
  4. copy /usr/include/freetype2/freetype to /usr/include/freetype
  5. compile inkscape!


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 CC=g++
export CXXFLAGS='-g -O0 -Wall'
export CFLAGS='-g -O0 -Wall'
./configure


Compiling on Sun Solaris

When trying to compile the CVS snapshot from 2004-05-27 with gcc 3.3.2 on a SunOS foo 5.8 Generic_108528-22 sun4u sparc SUNW,Sun-Fire-V240 machine, I had to fix a few things.

First, I installed the following packages:

autoconf-2.59
automake-1.8.3
intltool-0.30
expat-1.95.7
libpng-1.2.5
libsigc++-2.0.3
glib-2.4.2
glibmm-2.4.2
atk-1.7.0
render-0.8
xrender-0.8.3
xft-2.1.2
pango-1.4.0
gtk+-2.4.2
gtkmm-2.4.2

I configured Inkscape with the following switches:

./configure --prefix=/home/foo/Tools/ --includedir=/home/foo/Tools/include CPPFLAGS=-I/home/foo/Tools/include

Then "fix" stuff in the inkscape sources:

Uncomment "@INTLTOOL_DESKTOP_RULE@" in Makefile.

Use <inttypes.h>, not <stdint.h> in

src/display/sp-canvas.h,
src/livarot/DblLinked.h, 
src/livarot/LivarotDefs.h, 
src/livarot/AVL.h, 
src/livarot/Shape.h, 
src/livarot/ShapeUtils.h,
src/livarot/Ligne.h
src/livarot/AlphaLigne.h
src/livarot/BitLigne.h
src/livarot/MyMath.h

(see http://www.lns.cornell.edu/public/COMP/info/autoconf/Header-Portability.html)


Replace round() with rint() according to http://news.gw.com/freebsd.gnome/1237 in

src/object-edit.cpp, src/spiral-context.cpp src/star-context.cpp

fabsf() was undeclared (I just put in "fabs()", not sure if this is correct) in

src/sp-shape.cpp

(see http://gcc.gnu.org/ml/java/2001-01/msg00465.html).

Replaced fabsf(), floorf() and ceilf() with fabs(), floor() and ceil() in

src/display/nr-arena-shape.cpp
src/display/canvas-bpath.cpp
src/display/sp-ctrlline.cpp
src/libnrtype/nr-rasterfont.cpp
src/livarot/AlphaLigne.cpp
src/livarot/BitLigne.cpp
src/livarot/Ligne.cpp
src/livarot/PathOutline.cpp
src/livarot/ShapeMisc.cpp

isfinite() is undeclared, use

#include <ieeefp.h>

and finite() (see http://devrsrc1.external.hp.com/STKS/impacts/i61.html) in

src/display/bezier-utils.cpp

Need to include

#include <ieeefp.h>

in

src/libnr/nr-svp.cpp

Missing strcasestr() used in libnrtype/nr-type-directory.cpp. I just use the internal version for WIN32 given in the file.

In file included from /home/foo/Tools/include/X11/extensions/Xrender.h:33,
                 from /home/foo/Tools/include/X11/Xft/Xft.h:47,
                 from libnrtype/nr-type-xft.cpp:16:
/usr/openwin/include/X11/Xutil.h:56: warning: ignoring #pragma ident 
/usr/openwin/include/X11/Xutil.h:117: error: 'Bool' is used as a type, but is 
   not defined as a type.
/usr/openwin/include/X11/Xutil.h:120: error: 'Pixmap' is used as a type, but is 
   not defined as a type.
/usr/openwin/include/X11/Xutil.h:121: error: 'Window' is used as a type, but is 
   not defined as a type.
[...]

etc. Fixed this by adding #include <X11/Xlib.h> before including Xft.h in src/libnrtype/nr-type-xft.cpp.

`bind_textdomain_codeset' undeclared in src/main.cpp and src/inkscape.cpp. Just copied the definition in that file outside the ifdef.

`fpresetsticky' undeclared (autoconf seems to have checks for it. Solaris has fpsetsticky() when ieeefp.h is included.)

No rule for target inkscape.desktop - just created an empty rule.

DONE! It runs on Solaris! Yay! :) --Colin Marquardt