Difference between revisions of "Compiling Inkscape"

From Inkscape Wiki
Jump to navigation Jump to search
(add internal lib2geom instructions)
(Mark as outdated - moved to GitLab)
Line 1: Line 1:
<mark>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. </mark>
{{Outdated|message=Developer documentation has been moved to [https://gitlab.com/inkscape/inkscape/-/blob/master/doc/building/readme.md GitLab].}}
 
 
<mark> '''If you've come here without reading the Getting Started page, [https://inkscape.org/develop/getting-started/ please do so first], as it mentions some important things that this page does not.'''
</mark>
 
 
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 [https://inkscape.org/contribute/report-bugs/ 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 ==
 
* '''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
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.
Perhaps you should add the directory containing `gtkmm-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtkmm-2.0' found
</pre>
 
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>
 
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:
<pre>
mkdir build
cd build
cmake ..
make
</pre>
 
For old versions of inkscape before 0.92, you can still use autoconf:
<pre>
./autogen.sh # optionally
./configure
make
</pre>
 
Then, to run tests and install Inkscape, you may do:
<pre>
make check
sudo make install || su -c "make install"
</pre>
 
See INSTALL.md 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.
 
# Turn off optimization.
# Use ccache for faster compilation.
# Set up a separate build directory (nice for testing both gcc and g++, or cross-compiling).
# Use ninja or the make -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:
<pre>
mkdir build
git clone --recurse-submodules https://gitlab.com/inkscape/inkscape.git
cd build
cmake ../inkscape -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Debug -G Ninja
ninja
</pre>
 
See [[Testing Inkscape]] for information on building and executing (unit) tests.
 
=== Internal lib2geom ===
If the version of Inkscape you are trying to build depends on recent lib2geom features, you'll need to add <code>-DWITH_INTERNAL_2GEOM=ON</code> to the cmake command to use the development version of lib2geom rather than the system version.
[[Category:Developer Documentation]]

Revision as of 11:51, 31 May 2025

This page is outdated. It is kept for historical reasons, e.g. to document specific decisions in Inkscape development.

Developer documentation has been moved to GitLab.