Linux:Build from source
Languages: |
[[::Linux:Build from source|English]] • [[::Linux:Build from source/fr|français]] |
This page describes how to build Gramps from source on Linux. Building from source is appropriate for:
- Developers who need to be able to modify the source and have those modifications take effect.
- Packagers who need to be able to construct a package for installation by user.
- Advanced or experienced users who might want to install a version of Gramps that differs from the version that comes with their distribution.
To Build Gramps, the following considerations are important (though they do not necessarily need to be done in this sequence). They are covered below:
- Decide where to build/install Gramps. If you already have a version of Gramps you need to decide whether you will install in the same place, overwriting the existing version, or install elsewhere.
- Obtain the source. This might be a released source, or a development version. The released version may be a normal release, or an unstable alpha or beta release. The development version may be subject to continual change.
- Install all dependencies.
- Build and install Gramps.
Installing dependencies and building Gramps are considered separately for Gramps 3.x and Gramps 4.x.
Contents
Decide where to install
If you have an older version of the Gramps source code installed you need to make a decision what you want to do with it before installing a later version. If you wish to keep the old version, make sure that you read the instructions in the INSTALL file regarding the use of the --prefix option to specify where the new version gets installed.
See Installation_alternatives.
Should you just want to do a straightforward replacement instead, make sure that you remove the older version before you install the new version. Do not install over the top of the old version. As new versions of Gramps are developed, some functionality is occasionally rewritten in different ways. If you install over the top of an existing installation you run the risk that the old code left behind from the old version may be used instead of the new, sometimes with unintended consequences. If you installed from source, the best way of removing the old version is to run
make uninstall
as root from where you installed the old version. Use your distribution's package manager to uninstall if your old version was installed as a package.
Note that you should use your old Gramps version to export backup copies to GRAMPS XML before removing the old version.
Obtain the source
There are two ways to get the source code: download a released version source, or checkout the source from svn. Please, now is the time to read the INSTALL and README files accompanying the code. They come with the most recent information. Details on each download method:
Download a release
- The latest stable version of Gramps can be downloaded from the Gramps SourceForge file area. Eg: gramps-5.2.2.tar.gz. Extract this file into a directory:
tar xzvf gramps-zzz.tar.gz
and then go into this directory:
cd gramps-zzz
Download the source from svn
- If you are interested in testing out the very latest development versions of Gramps, they can be obtained from SVN, see Brief introduction to SVN. The SVN versions of Gramps are potentially very dangerous as they have not been extensively tested - especially the "trunk" version which contains features that may still be partly implemented. Be aware that they may be prone to crashing and cause extensive data loss. Please use with extreme caution - and only ever on a copy of your data!
You can get a branch version (similar as above) or the latest bleeding-edge version through SVN, You can download a specific release via a tag, or you can download the latest development.
First, you need subversion installed, eg on Debian based linux:
sudo apt-get install subversion
Then, download a tagged version:
svn co https://svn.code.sf.net/p/gramps/code/tags/gramps-4.0.0/ gramps
or latest development:
svn co https://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40 gramps40
for the most recent development version, see Getting started with Gramps Trunk.
Install dependencies for Gramps 3.4.x
General requirements
Gramps 3.x requires python 2.6 or greater, pygtk 2.16 or greater and librsvg2
Linux package requirements
Debian /Ubuntu | Fedora /Redhat | Comment |
---|---|---|
python | python | Required (needs version 2.6 or later) |
python-gtk2 | pygtk2 | Required (needs 2.16 or greater) |
BSDDB | BSDDB | Current backend |
librsvg2-common | librsvg2 | Required for building |
libglib2.0-dev | glib2-devel | Required for building |
librsvg2-devel | Required for building | |
intltool | intltool | Required for building |
gcc make gettext | Required for building | |
xdg-utils | xdg-utils | Required for Gramps-3.1.x or later |
rcs | rcs | Suggested for running |
python-gtkspell | gnome-python2-gtkspell | Suggested for running (spell check). Included in the python-gnome2-extras package in older Debian distributions. |
python-webkit python-gtkmozembed | WebKitgtk pywebkitgtk | Required for the HTML view |
python-pygoocanvas | goocanvas pygoocanvas | Required for Graph View |
graphviz | graphviz graphviz-python | Required for some reports and views |
Django | Required for http://gramps-connect.org Gramps-Connect | |
python-pyexiv2 | pyexiv2 | Required for the Metadata Viewer and Edit Exif Metadata gramplets |
libosmgpsmap-dev python-osmgpsmap | osm-gps-map | Required for the Geography views |
gtk2-engines-pixbuf | Solves issue with 'Unable to locate theme engine in module_path: "pixmap"' |
Under Redhat/Fedora you can install all of the above with:
sudo yum install python pygtk2 xdg-utils rcs gnome-python2-gtkspell librsvg2 \ librsvg2-devel intltool gnome-doc-utils gcc automake autoconf autogen \ gettext WebKitgtk pywebkitgtk goocanvas pygoocanvas graphviz graphviz-python \ Django pyexiv2 inkscape ImageMagick
Build, Install and Run Gramps 3.4.x
Gramps provides a script that can be used to prepare the code for building. This script automatically calls the standard configure script:
./autogen.sh
# as regular user
This script will report any missing dependencies. Install these (see also INSTALL file). Building from source code typically requires that the development versions of the required libraries be installed. You might consider setting a prefix path with autogen.sh, see the INSTALL file for instructions. Standard install is in /usr/local.
Once a successful run of autogen.sh has been completed, you can run the typical make procedure.
make
# as regular user
then
make install
# as root
Local installation without root privileges is possible, instructions are available on the INSTALL file, most importantly one needs to supply a --prefix=
and a --with-mime-dir=
argument to autogen.sh
.
Starting Gramps - TBD
Install dependencies for Gramps 4.x
For installation and build, see also;
- GEPS_029:_GTK3-GObject_introspection_Conversion (discusses Ubuntu 12.10 and 12.04, LinuxMint 14 and Debian). This is particularly relevant for building components that are not provided by those distributions, and for GTK 3 themes.
- GEPS_031:_Python_3_support
- GEPS_026:_Replace_'make'_for_Gramps_build
General requirements
Gramps 4.0 requires python 2.7 or python 3.2 or greater. At the moment, python 2.7 is still the most stable way to use Gramps! Also needed are GTK 3.0 or greater, pygobject 3.3.2 or greater, cairo, pango, pangocairo with introspection bindings (the gi packages), librsvg2 (svg icon view), xdg-utils. Furthermore, bsddb3 is required for Python 3.2 (not python 2.7).
Linux package requirements
The full list of requirements is given in the README file.
Required
Debian /Ubuntu | Fedora /Redhat | Comment |
---|---|---|
python | python | Required (needs version 2.7 or later or 3.2 or later) |
python-gobject, python-gi | ? | Required (needs pygobject 3.3.2 or greater) |
python-cairo python-gi-cairo | ? | Required |
gir1.2-pango | ? | Required |
gir1.2-gtk | ? | Required is GTK 3.6+ |
gir1.2-freedesktop | ? | Not clear why this is included in the full installation walkthrough |
Not mentioned in the full installation walkthrough
Debian /Ubuntu | Fedora /Redhat | Comment |
---|---|---|
BSDDB | BSDDB | Current backend, python3-bsddb3 for python 3! |
xdg-utils | xdg-utils | Required for Gramps-3.1.x or later |
libgtkspell-3-0 python-gtkspell | ? | Required spell checking |
Required for building
Debian /Ubuntu | Fedora /Redhat | Comment |
---|---|---|
librsvg2-common | librsvg2 | Required for building |
python-dev libglib2.0-dev | glib2-devel | Required for building |
python-gobject-dev libgirepository1.0-dev | ? | |
libcairo2-dev python-cairo-dev | ? | |
librsvg2-devel | Required for building | |
intltool | intltool | Required for building |
gcc make gettext | Required for building |
Strongly recommended
Debian /Ubuntu | Fedora /Redhat | Comment |
---|---|---|
'Not available' | 'Not available' | osmgpsmap. Required for the Geography views. Needs patches that are not available in the official version. Needs to be built from source. |
graphviz | graphviz graphviz-python | Required for some reports and views |
python-pyicu | ? | Required for correct sorting |
Optional
Debian /Ubuntu | Fedora /Redhat | Comment |
---|---|---|
'Not available' | 'Not available' | gtkspell. Suggested for running (spell check). Needs to be build from source. See install spell check |
rcs | rcs | Suggested for running |
Python Image Library | ? | ? |
'Not available' | 'Not available' | gexiv2 Required for the Metadata Viewer and Edit Exif Metadata gramplets. Minimally version 0.5 is needed, but only 0.4 is available in Ubuntu 13.04. Needs to be build from source. |
ttf-treefont | ? | ? |
python-webkit python-gtkmozembed | WebKitgtk pywebkitgtk | Required for the HTML view |
python-pygoocanvas gir1.2-goocanvas-2.0-9 | goocanvas pygoocanvas | Required for Graph View |
Django | Required for http://gramps-connect.org Gramps-Connect | |
gtk2-engines-pixbuf | Solves issue with 'Unable to locate theme engine in module_path: "pixmap"' |
Under Redhat/Fedora you can install all of the above with:
sudo yum install python pygtk2 xdg-utils rcs gnome-python2-gtkspell librsvg2 \ librsvg2-devel intltool gnome-doc-utils gcc automake autoconf autogen \ gettext WebKitgtk pywebkitgtk goocanvas pygoocanvas graphviz graphviz-python \ Django pyexiv2 inkscape ImageMagick
Local installation without root privileges is possible, instructions are available on the INSTALL file.
Build, Install and Run Gramps 4.x
python setup.py build
The way you run Gramps depends on whether you downloaded a release or downloaded from the SVN repository.
Running a release
See [[1]]
With a tarbal, gramps should be run from the build directory, or from installed version (which can be installed locally).
python setup.py build
go to where the scripts are installed:
cd build/scripts-2.7
in build GRAMPS_RESOURCES must also be set to actually run it:
GRAMPS_RESOURCES=/home/benny/gramps/branches/maintenance/gramps40/build/lib.linux-x86_64-2.7/ PYTHONPATH=$GRAMPS_RESOURCES:$PYTHONPATH ./gramps
I dislike that GRAMPS_RESOURCES must be set from build, it would be nice if that would not be needed from the build directory, but ok, build is just an in between stage.
Running from build is only to try out before a real install, and that works, eg install to a test directory (or to a directory you have chosen following decide where to install
python setup.py install --root ~/gramps/test cd ~/gramps/test/usr/local/bin
as this is a test dir, PYTHONPATH must be set to point to the locally installed gramps package :
PYTHONPATH=~/gramps/test/usr/local/lib/python2.7/dist-packages/:$PYTHONPATH ./gramps
Running from an SVN repository
Gramps.py is only for those that check out the code repository. Gramps.py is a fake file to allow developers to run code from the source dir, not what the user should be doing.
If you now run
python Gramps.py -v
you should see all required packages are found. You can now start Gramps locally with the command
python Gramps.py
Full install walkthrough Gramps 4.0 Ubuntu derivatives
Following walkthrough was done on a clean install of Kubuntu 13.04 which did have the GTK applications firefox, inkscape and gimp installed. Equal steps should be done on other platforms.
sudo apt-get install subversion svn co https://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40 gramps40 cd gramps40 sudo apt-get install intltool python setup.py build sudo apt-get install python-gobject python-gi python-cairo python-gi-cairo sudo apt-get install gir1.2-freedesktop gir1.2-pango sudo apt-get install gir1.2-gtk
If you now run
python Gramps.py -v
you should see all required packages are found. You can now start Gramps locally with the command
python Gramps.py
To install optional components, do the following:
sudo apt-get install python-pyicu graphviz rcs gir1.2-webkit-3
This gives all the easy optional functionality in Gramps. The rest is not yet present in Ubuntu 13.04, so if you want them, you need to compile them
spell checking Remove first present version, check that this command does not remove programs you use!
sudo apt-get remove libgtkspell-3-0 python-gtkspellcheck
Now we obtain the code to build this package
sudo apt-get install mercurial hg clone http://hg.code.sf.net/p/gtkspell/code gtkspell-code cd gtkspell-code sudo apt-get install build-essential sudo apt-get install libgirepository1.0-dev sudo apt-get install valac libgtk-3-dev aclocal ; autoheader; automake ; autoconf ./autogen.sh make sudo make install sudo cp /usr/local/lib/girepository-1.0/GtkSpell-3.0.typelib /usr/lib/girepository-1.0/ sudo cp /usr/local/lib/libgtkspell3-3.* /usr/lib/
osmgpsmap The geography view needs patches which are not included yet in the official version.
sudo apt-get install git git clone git://github.com/nzjrs/osm-gps-map.git cd osm-gps-map sudo apt-get install libsoup2.4-dev gnome-common gtk-doc-tools ./autogen.sh --prefix /usr make sudo make install
gexiv2 Minimally version 0.5 is needed, but only 0.4 is available in 13.04. So remove 0.4 if present, and we add 0.5 or later ourselves. Obtain it from [2], I downloaded 0.6.1, and extracted it in directory libgexiv2-0.6.1. To install this
cd libgexiv2-0.6.1 sudo apt-get install exiv2 libexiv2-dev ./configure --enable-introspection --prefix=/usr make sudo make install
run Gramps You can now use gramps from the source directory with
python Gramps.py
You could install Gramps, but you better wait for a packages distributed from [3] and install those via your package manager
look and feel Normally, Gramps does not look that nicely when not used on Gnome desktop. To remedy this, install a theme switcher. You can edit configuration files if you don't like to install these dependencies, see eg [4]
sudo apt-get install gnome-tweak-tool
You can search on gtk 3 themes in your package manager and install one that you like. For example, install clearlooks:
sudo apt-get install clearlooks-phenix-theme
then use the gnome-tweak-tool to switch to that. For KDE you need to go also to Settings->Appearance->GTK and set the GTK 3 theme there to the one you installed.
Full install walkthrough Windows
On windows, you can install virtualbox and then install K/X/Ubuntu as indicated above, which will give you linux in windows.
The native windows support for Gramps 4.0 is being worked on. You find the current walkthrough on the dedicated page