Linux:Build from source
This article's content is incomplete or a placeholder stub. |
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.0 - 4.1 and Gramps 4.2+
Contents
Decide where to install
Note Backup your old Family Trees before removing the old version of Gramps You should use your old Gramps version to export backup copies to GRAMPS XML before removing the old Gramps version. |
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 Gramps 3.x or earlier version is to run make uninstall
as root from where you installed the old version.
Or use your distribution's package manager to uninstall if your old Gramps version was installed as a package.
Gramps 4.2 and up
Gramps 4.2 and beyond only work with Python 3.2 or greater. This should be handled automatically if Gramps is installed from your distro's repository.
If installing using a tar or git source, you need to replace 'python' with 'python3' for the various setup and run commands below.
The following packages are required, and should be installed automatically as dependencies with the Gramps package. (This list is for Gramps 4.2.0 on Kubuntu 15.10.)
For v5.0 add sqlite3. |
Debian /Ubuntu | Fedora /Redhat | Comment |
---|---|---|
gir1.2-atk-1.0 | ||
gir1.2-freedesktop | ||
gir1.2-gdkpixbuf-2.0 | ||
gir1.2-gexiv2-0.10 | ||
gir1.2-gtk-3.0 | ||
gir1.2-osmgpsmap-1.0 | ||
gir1.2-pango-1.0 | ||
graphviz | ||
libcdt5 | ||
libcgraph6 | ||
libgexiv2-2 | ||
libgvc6 | ||
libgvpr2 | ||
libosmgpsmap-1.0 | ||
libpathplan4 | ||
python3-bsddb3 | ||
python3-cairo | ||
python3-gi-cairo | ||
python3-icu | ||
python3.5 | ||
python3.5-minimal |
With the standard dependencies, Gramps still gives some warnings about missing packages. The following packages address these warnings.
Debian /Ubuntu | Fedora /Redhat | Comment |
---|---|---|
language-pack-gnome-en | or the equivalent for your language and locale | |
gir1.2-goocanvas-2.0 | ||
python3-django |
Gramps 4.0 to 4.1
Obtain the source
There are two ways to get the source code: download a released version source, or clone the source from Git.
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 Github file Releases area. Eg: gramps-5.2.3.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 Git
- If you are interested in testing out the very latest development versions of Gramps, they can be obtained from Git, see Brief introduction to Git. The Git versions of Gramps are potentially very dangerous as they have not been extensively tested - especially the master branch 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 the Gramps repository through Git. First, you need Git installed, eg on Debian based linux:
sudo apt-get install git
Then, clone the repository:
git clone https://github.com/gramps-project/gramps.git Gramps
A branch called master containing the latest development code will be created for you.
To checkout a maintenance branch use:
git checkout -b gramps42 origin/maintenance/gramps42
Note replace 42 with the latest branch 51 if required. |
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 to Gramp 4.1 requires python 2.7 or python 3.2 or greater.
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 (eg, with hunspell) |
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 ( Internationalization Tool Collection - Utility scripts for internationalizing XML.) |
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. See compile and install OsmGpsMap |
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 | ? | ? |
gir1.2-gexiv2-0.4 | 'Not available' | Required for the Metadata Viewer gramplet |
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 Addon:Graph View |
python3-django | 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
Under Debian/Ubuntu you can install all of the above with:
sudo apt-get install python python-gobject python-gi python-cairo python-gi-cairo \ gir1.2-pango gir1.2-gtk xdg-utils libgtkspell3-3-0 python-gtkspell \ librsvg2-common python-dev libglib2.0-dev python-gobject-dev libgirepository1.0-dev \ libcairo2-dev python-cairo-dev intltool graphviz python-pyicu \ rcs ttf-freefont python-webkit python-pygoocanvas gir1.2-goocanvas-2.0-9 \ gtk2-engines-pixbuf
Local installation without root privileges is possible, instructions are available on the INSTALL file.
Build, Install and Run Gramps 4.0 to Gramps 5.x
Note that the 'python' commands below need to be 'python3' for Gramps 4.2 and later.
python setup.py build
The way you run Gramps depends on whether you downloaded a release or downloaded from the Git repository.
Running from a tarball release
See [1]
With a tarball, 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:
- For python 2 look in:
cd build/scripts-2.7
- For python 3 look in:
cd build/scripts-3.4
(Note the number 3.4 depends on your version of python and in most cases where you see the number 2.7 replace it with your version number in the example commands below)
in build GRAMPS_RESOURCES must also be set to actually run it:
GRAMPS_RESOURCES=/home/benny/gramps/branches/maintenance/gramps51/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 a Git 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 using.
If you now run
python Gramps.py -v
or
python3 Gramps.py -v
Gramps will show the version information summary and if all required packages are found, if not install the missing requirements.
Then you can start Gramps locally with the command
python Gramps.py
or
python3 Gramps.py
Full install walkthrough Gramps 4 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. Equivalent steps should be done on other platforms.
sudo apt-get install git git clone http://git.code.sf.net/p/gramps/source Gramps cd Gramps git checkout -b gramps51 origin/maintenance/gramps51 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 sudo apt-get install gir1.2-gexiv2-0.4
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. Ubuntu 13.10 contains version 0.6.1 in the gir1.2-gexiv2-0.4 package. If you have an older version, remove it and install from source using the following instructions:
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 walk-through Windows
The native windows support for Gramps 4.x takes a bit more effort. You can follow the walk-through for
- Run Gramps40 for Windows from source using Python 2.7.3
- Run Gramps40 for Windows from source using Python 3.4 (Not available, but you should be able to follow the instructions for the Python 2.7.3 version and modify accordingly)
An alternative on windows is to install virtualbox and then install K/X/Ubuntu as indicated above, which will give you Linux in windows.
Gramps 3.4.x
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). eg, via hunspell. Included in the python-gnome2-extras package in older Debian distributions. |
python-webkit | WebKitgtk pywebkitgtk | Required for the HTML view |
python-pygoocanvas | goocanvas pygoocanvas | Required for Addon: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 ImageMagick
Under Debian/Ubuntu you can install all of the above with:
sudo apt-get install python python-gtk2 librsvg2-common libglib2.0-dev \ intltool xdg-utils rcs python-gtkspell \ python-webkit python-pygoocanvas graphviz python-pyexiv2 \ libosmgpsmap-dev python-osmgpsmap gtk2-engines-pixbuf
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 - ??