Difference between revisions of "Compiling Inkscape"

From Inkscape Wiki
Jump to navigation Jump to search
(Quick review)
Line 1: Line 1:
Hopefully, Inkscape will compile right out of the box. 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
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.
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
If legitimate bugs are found or patches developed, please move them to the [https://bugs.launchpad.net/inkscape tracker] rather than inlining them here.   
rather than inlining them here.   


= Notes =
== Notes ==
Inkscape needs automake 1.7, 1.8 or 1.10 and higher. Please consider NOT using automake1.9, because 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.
Inkscape needs automake 1.7, 1.8, 1.10 or higher. Please consider NOT using automake 1.9, because it has a bug that may prevent Inkscape from compiling.


= CMake Notes =
You may want to also [[Related programs#Inkscape Plugins, Scripts, and Templates|add plugins]] during or after compiling.
 
== CMake Notes ==


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


Work is in progress to build Inkscape using CMake. Please see the [[CMake]] Wiki page. For windows developers some notes are on the [[Compiling Inkscape on Windows 64-bit]] page.
Work is in progress to build Inkscape using CMake. Please see the [[CMake]] wiki page. For Windows developers some notes are on the [[Compiling Inkscape on Windows 64-bit]] page.
 
== OS & Distribution Specific ==


= OS & Distribution Specific =
* '''Linux'''
* '''Linux'''
** [[CompilingAutopackage|Autopackage]] (multi-distro)
** [[CompilingAutopackage|Autopackage]] (multi-distro)
Line 41: Line 40:
** [[CrossCompilingWindows|For Windows (from Linux)]]
** [[CrossCompilingWindows|For Windows (from Linux)]]


= Package Config (pkg-config) =
== 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
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:
compile them or Inkscape itself:
 
<pre>
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.
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'
Perhaps you should add the directory containing `gtkmm-2.0.pc'
to the PKG_CONFIG_PATH environment variable
to the PKG_CONFIG_PATH environment variable
No package 'gtkmm-2.0' found
No package 'gtkmm-2.0' found
</pre>


A solution is to set the PKG_CONFIG_PATH variable as so:
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>
* for csh: <code>setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/pkgconfig</code>


for bash:
A good place to put this line is in your .bashrc or .cshrc file.
    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 ==
 
= 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]].
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 =
== Developer Compilation ==


Plain vanilla compilation is done as documented in INSTALL; ./autogen.sh (optionally); ./configure; make; su && make check; make install (optional).  See INSTALL for more on that.
Plain vanilla compilation is done as documented in INSTALL:
<pre>
./autogen.sh # optionally
./configure
make
make check
su -c "make install" # optionally
</pre>
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,
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.
to get best results.


# Turn off optimization
# Turn off optimization.
# Use ccache for faster compilation
# Use ccache for faster compilation.
# Set up a separate build directory (nice for testing both gcc and g++, or cross compiling)
# Set up a separate build directory (nice for testing both gcc and g++, or cross-compiling).
# Use the -j N flag to increment the number of threads available to make, with N = 1 + number of processors
# 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
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:
compilations on a dual-processor machine, with no optimization and full debug symbols, assuming /bin/bash:
 
<pre>
mkdir build
mkdir build
bzr checkout lp:inkscape
bzr checkout lp:inkscape
cd inkscape
cd inkscape
./autogen.sh
./autogen.sh
cd ../build
cd ../build
export CFLAGS="-g -O0 -Wall" CC="ccache gcc"
export CFLAGS="-g -O0 -Wall" CC="ccache gcc"
export CXXFLAGS="-g -O0 -Wall" CXX="ccache g++"
export CXXFLAGS="-g -O0 -Wall" CXX="ccache g++"
../inkscape/configure
../inkscape/configure
make -j 3 -k
make -j 3 -k
 
</pre>


Turning off just optimization:
Turning off just optimization:
<pre>
export CXXFLAGS="-g -O0 -Wall"
export CFLAGS="-g -O0 -Wall"
./configure
</pre>


export CXXFLAGS="-g -O0 -Wall"
See [[Testing Inkscape]] for information on building and executing (unit) tests.
export CFLAGS="-g -O0 -Wall"
./configure
 
See [[TestingInkscape]] for information on building and executing (unit) tests.


[[Category:Developer Documentation]]
[[Category:Developer Documentation]]

Revision as of 04:19, 12 July 2016

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 rather than inlining them here.

Notes

Inkscape needs automake 1.7, 1.8, 1.10 or higher. Please consider NOT using automake 1.9, because it has a bug that may prevent Inkscape from compiling.

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

CMake Notes

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

Work is in progress to build Inkscape using CMake. Please see the CMake wiki page. For Windows developers some notes are on the Compiling Inkscape on Windows 64-bit 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:

./autogen.sh # optionally
./configure
make
make check
su -c "make install" # optionally

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.