Difference between revisions of "Compiling Inkscape"

From Inkscape Wiki
Jump to navigation Jump to search
(removing spam)
 
(cleanup outdated details)
(113 intermediate revisions by 31 users not shown)
Line 1: Line 1:
=== Compiling Inkscape ===
Hopefully, Inkscape will compile right out of the box, according to the 'Getting Started' instructions on https://inkscape.org/develop/getting-started/ . If it doesn't, well that's what this page is for.


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.


Jot down notes, questions, findings, tips, etc. here on things you run intoIt's a good idea to
If legitimate bugs are found or patches developed, please move them to the [https://inkscape.org/contribute/report-bugs/ tracker] rather than inlining them here.   
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
== Notes ==
rather than inlining them here. 


=== GtkMM ===
Please use CMake instead of Automake for Inkscape 0.92 onwards.
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.
CMake is a crossplatform makefile generator similar to autotools. It tests dependencies and creates makefiles to be used with make.
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:
Please see the [[CMake]] wiki page.


    setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/pkgconfig
== OS & Distribution Specific ==


* '''Linux'''
** [[CompilingUbuntu|Ubuntu]]
** [[CompilingSlackware|Slackware]]
* [[CompilingMacOsX|Mac OS X]]
* [[Compiling Inkscape on Windows|Windows]]
* [[Compiling Inkscape on Chrome OS|Chrome OS]]
* '''Cross-compiling'''
** [[CrossCompilingOsX|For OS X (from Linux)]]
** [[CrossCompilingWindows|For Windows (from Linux)]]


== 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
=== Boehm Garbage Collector Dependency ===
compile them or Inkscape itself:
 
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)
 
 
=== MS Windows ===
 
See the [[Win32Port]] page
 
 
 
=== 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:<br>
 
$ tar zxvf inkscape-0.35-pre0.tar.gz
 
Try to ./configure and find out that you need libpng.<br>
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.)<br>
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.<br>
Go back to your InkScape source directory and re./configure.<br>
InkScape will happily compile now!<br>
 
-- Daniel Díaz
 
=== 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.)
<pre>
<pre>
LIBRARY_PATH=/usr/X11R6/lib:/sw/lib
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.
CPATH=/sw/include
Perhaps you should add the directory containing `gtkmm-2.0.pc'
PATH="/usr/X11R6/bin:"$PATH
to the PKG_CONFIG_PATH environment variable
export LIBRARY_PATH
No package 'gtkmm-2.0' found
export CPATH
export LDFLAGS
export PATH
export LIBS="-L/sw/lib -lintl "$LIBS
</pre>
</pre>


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 .
A solution is to set the PKG_CONFIG_PATH variable as so:
 
* for Bash: <code>export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig</code>
-- Spundun
* for csh: <code>setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/pkgconfig</code>
 
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:
 
<pre>
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
</pre>
 
-- 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
 
=== 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
 
==== 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
 
=== 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.
A good place to put this line is in your .bashrc or .cshrc file.


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


#  Turn off optimization
If your distro does not have some packages available (like many don't, ie, Fedora Core 2), you must often download and build source packages and/or install them yourself. See [[Tracking Dependencies]].
#  Use ccache for faster compilation
#  Set up a separate build directory (nice for testing both gcc and g++, or cross compiling)
#  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
== Developer Compilation ==
compilations on a dual-processor machine, with no optimization, assuming /bin/bash:


mkdir build-gcc build-g++
Plain vanilla compilation is done as documented in INSTALL.
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):
Now, you should use [[CMake]] to compile Inkscape:
 
export CC=g++
export CXXFLAGS='-g -O0 -Wall'
export CFLAGS='-g -O0 -Wall'
./configure
 
 
=== 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:''
 
* <a href="http://www.inkscape.org/doc/inkscape-1.0.ebuild">Download it</a> (pretty obvious isn't it ? :)
* Copy the file into /usr/portage/media-gfx/inkscape/
* run the command 'emerge inkscape' in root
* Drink a coffee or two
* Enjoy !
 
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<br>
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.
 
=== Compiling on Sun Solaris ===
 
When trying to compile the CVS snapshot from 2004-05-27 with
gcc 3.3.2 on a
<nowiki>SunOS foo 5.8 Generic_108528-22 sun4u sparc SUNW,Sun-Fire-V240</nowiki>
machine, I had to fix a few things.
 
First, I installed the following packages:
<pre>
<pre>
autoconf-2.59
mkdir build
automake-1.8.3
cd build
intltool-0.30
cmake ..
expat-1.95.7
make
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
</pre>
</pre>


I configured Inkscape with the following switches:  
For old versions of inkscape before 0.92, you can still use autoconf:
<pre>
<pre>
./configure --prefix=/home/foo/Tools/ --includedir=/home/foo/Tools/include CPPFLAGS=-I/home/foo/Tools/include
./autogen.sh # optionally
./configure
make
</pre>
</pre>


Then "fix" stuff in the inkscape sources:
Then, to run tests and install Inkscape, you may do:
 
Uncomment "@INTLTOOL_DESKTOP_RULE@" in Makefile.
 
Use <inttypes.h>, not <stdint.h> in
<pre>
<pre>
src/display/sp-canvas.h,
make check
src/livarot/DblLinked.h,
sudo make install || su -c "make install"
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
</pre>
</pre>
(see
http://www.lns.cornell.edu/public/COMP/info/autoconf/Header-Portability.html)


Replace round() with rint() according to
See INSTALL for more on that.
http://news.gw.com/freebsd.gnome/1237 in
</pre>
src/object-edit.cpp,
src/spiral-context.cpp
src/star-context.cpp
</pre>


fabsf() was undeclared (I just put in "fabs()", not sure if this is
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.
correct) in
<pre>
src/sp-shape.cpp
</pre>
(see
http://gcc.gnu.org/ml/java/2001-01/msg00465.html).


Replaced fabsf(), floorf() and ceilf() with fabs(), floor() and ceil() in
# Turn off optimization.
<pre>
# Use ccache for faster compilation.
src/display/nr-arena-shape.cpp
# Set up a separate build directory (nice for testing both gcc and g++, or cross-compiling).
src/display/canvas-bpath.cpp
# Use the -j N flag to increment the number of threads available to make, with N = 1 + number of processors.
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
</pre>


isfinite() is undeclared, use
Example:  Setting up the build environment (in separate tree), and using ccache for faster
compilations on a dual-processor machine, with no optimization and full debug symbols, assuming /bin/bash:
<pre>
<pre>
#include <ieeefp.h>
mkdir build
</pre>
bzr checkout lp:inkscape
and finite() (see http://devrsrc1.external.hp.com/STKS/impacts/i61.html) in
cd inkscape
<pre>
./autogen.sh
src/display/bezier-utils.cpp
cd ../build
export CFLAGS="-g -O0 -Wall" CC="ccache gcc"
export CXXFLAGS="-g -O0 -Wall" CXX="ccache g++"
../inkscape/configure
make -j 3 -k
</pre>
</pre>


Need to include
Turning off just optimization:
<pre>
<pre>
#include <ieeefp.h>
export CXXFLAGS="-g -O0 -Wall"
export CFLAGS="-g -O0 -Wall"
./configure
</pre>
</pre>
in
<pre>
src/libnr/nr-svp.cpp
</pre>
Missing strcasestr() used in libnrtype/nr-type-directory.cpp. I just
use the internal version for WIN32 given in the file.
<pre>
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.
[...]
</pre>
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
=== 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
See [[Testing Inkscape]] for information on building and executing (unit) tests.


--Luke Munholand
[[Category:Developer Documentation]]

Revision as of 15:00, 28 May 2019

Hopefully, Inkscape will compile right out of the box, according to the 'Getting Started' instructions on https://inkscape.org/develop/getting-started/ . 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 rather than inlining them here.

Notes

Please use CMake instead of Automake for Inkscape 0.92 onwards.

CMake is a crossplatform makefile generator similar to autotools. It tests dependencies and creates makefiles to be used with make.

Please see the CMake wiki page.

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.

Dependencies

If your distro does not have some packages available (like many don't, ie, Fedora Core 2), you must often download and build source packages and/or install them yourself. See Tracking Dependencies.

Developer Compilation

Plain vanilla compilation is done as documented in INSTALL.

Now, you should use CMake to compile Inkscape:

mkdir build
cd build
cmake ..
make

For old versions of inkscape before 0.92, you can still use autoconf:

./autogen.sh # optionally
./configure
make

Then, to run tests and install Inkscape, you may do:

make check
sudo make install || su -c "make install"

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 increment the number of threads available to make, with N = 1 + number of processors.

Example: Setting up the build environment (in separate tree), and using ccache for faster compilations on a dual-processor machine, with no optimization and full debug symbols, assuming /bin/bash:

mkdir build
bzr checkout lp:inkscape
cd inkscape
./autogen.sh
cd ../build
export CFLAGS="-g -O0 -Wall" CC="ccache gcc"
export CXXFLAGS="-g -O0 -Wall" CXX="ccache g++"
../inkscape/configure
make -j 3 -k

Turning off just optimization:

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

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