Difference between revisions of "Compiling Inkscape"

From Inkscape Wiki
Jump to navigation Jump to search
(cleanup outdated details)
 
(86 intermediate revisions by 30 users not shown)
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, 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
+
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://inkscape.org/contribute/report-bugs/ tracker] rather than inlining them here.   
rather than inlining them here.   
 
  
= OS & Distribution Specific =
+
== Notes ==
* '''Linux'''
 
** [[CompilingFC2|Fedore Core 2]]
 
** [[CompilingGentoo|Gentoo]]
 
** [[CompilingDebian|Debian]]
 
** [[CompilingYellowDog|Yellow Dog]]
 
** [[CompilingSuse|Suse]]
 
** [[CompilingSlackware|Slackware]]
 
** [[CompilingYoper|Yoper]]
 
* [[CompilingMacOsX|Mac OS X]]
 
* [[Win32Port|Windows]]
 
* [[CompilingSPARC|SPARC]]
 
* [[CompilingSunSolaris|Sun Solaris]]
 
  
 +
Please use CMake instead of Automake for Inkscape 0.92 onwards.
  
= Specific Package Problems + Solutions =
+
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.
  
== [http://www.dotmoment.com/generic-viagra Generic Viagra] [http://www.dotmoment.com/generic-propecia Generic Propecia] [http://www.dotmoment.com/generic-glucophage Generic Glucophage] [http://www.dotmoment.com/generic-lipitor Generic Lipitor] GtkMM ==
+
== OS & Distribution Specific ==
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.
+
* '''Linux'''
Perhaps you should add the directory containing `gtkmm-2.0.pc'
+
** [[CompilingUbuntu|Ubuntu]]
to the PKG_CONFIG_PATH environment variable
+
** [[CompilingSlackware|Slackware]]
No package 'gtkmm-2.0' found
+
* [[CompilingMacOsX|Mac OS X]]
 
+
* [[Compiling Inkscape on Windows|Windows]]
A solution suggested by Ishmal is to set the PKG_CONFIG_PATH variable as so:
+
* [[Compiling Inkscape on Chrome OS|Chrome OS]]
 
+
* '''Cross-compiling'''
    setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/pkgconfig
+
** [[CrossCompilingOsX|For OS X (from Linux)]]
 
+
** [[CrossCompilingWindows|For Windows (from Linux)]]
 
 
 
 
 
 
== 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
+
== Package Config (pkg-config) ==
  
Then configure it with the command:
+
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>
  
  $ ./configure --enable-cplusplus
+
A solution is to set the PKG_CONFIG_PATH variable as so:
  $ make; make install
+
* 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.
  
Also, if searching for a package for GC, the name of it is sometimes:
+
== Dependencies ==
  
* gc
+
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]].
* libgc
 
* libgc-devel
 
* boehm-gc  (on Gentoo)
 
  
 +
== 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>
  
= Developer Compilation =
+
For old versions of inkscape before 0.92, you can still use autoconf:
 +
<pre>
 +
./autogen.sh # optionally
 +
./configure
 +
make
 +
</pre>
  
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.
+
Then, to run tests and install Inkscape, you may do:
 +
<pre>
 +
make check
 +
sudo make install || su -c "make install"
 +
</pre>
  
But if you're going to be doing a lot of development, there's some tricks and techniques you should know,
+
See INSTALL for more on that.
to get best results.
 
  
#  Turn off optimization
+
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.
#  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
+
# Turn off optimization.
compilations on a dual-processor machine, with no optimization, assuming /bin/bash:
+
# 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 increment the number of threads available to make, with N = 1 + number of processors.
  
  mkdir build-gcc build-g++
+
Example: Setting up the build environment (in separate tree), and using ccache for faster
cvs checkout inkscape
+
compilations on a dual-processor machine, with no optimization and full debug symbols, assuming /bin/bash:
cd inkscape
+
<pre>
libtoolize --copy --force
+
mkdir build
./autogen.sh
+
bzr checkout lp:inkscape
cd ../build-gcc
+
cd inkscape
CFLAGS='-g -O0 -Wall' CC='ccache gcc' ../inkscape/configure
+
./autogen.sh
cd ../build-g++
+
cd ../build
CXXFLAGS='-g -O0 -Wall' CXX='ccache g++' ../inkscape/configure
+
export CFLAGS="-g -O0 -Wall" CC="ccache gcc"
cd build-gcc && make -j 3
+
export CXXFLAGS="-g -O0 -Wall" CXX="ccache g++"
cd build-g++ && make -j 3
+
../inkscape/configure
 +
make -j 3 -k
 +
</pre>
  
 +
Turning off just optimization:
 +
<pre>
 +
export CXXFLAGS="-g -O0 -Wall"
 +
export CFLAGS="-g -O0 -Wall"
 +
./configure
 +
</pre>
  
Turning off just optimization (which can produce strange results in debuggers):
+
See [[Testing Inkscape]] for information on building and executing (unit) tests.
  
export CC=g++
+
[[Category:Developer Documentation]]
export CXXFLAGS='-g -O0 -Wall'
 
export CFLAGS='-g -O0 -Wall'
 
./configure
 

Latest 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.