Difference between revisions of "Building"

From GnuCash
Jump to: navigation, search
m
(Get the Sources: add a breakout page)
(45 intermediate revisions by 7 users not shown)
Line 2: Line 2:
  
 
=== Disclaimer ===
 
=== Disclaimer ===
This page deals with building the '''developers version''' of GnuCash from the ''[[Git]] repository''. If you are searching instructions for the ''stable version'', you should read [[GnuCash#Installation]].
+
This page deals with building the GnuCash from the source code. It includes building the current stable release from source code (downloaded tarballs as well as well as the '''developers version''' of GnuCash from the ''[[Git]] repository''. If you are searching instructions for the ''stable version''available from your distributions software repositories, you should read [[GnuCash#Installation]].
  
This page doesn't provide instructions for optional third-party modules like Perl Finance::Quote.
+
This page doesn't provide specific instructions for optional third-party modules like ''AqBanking'' or Perl ''Finance::Quote'' but does list the dependencies required and links to the configuration switches used with CMake to include them during compilation.
  
=== Get the Sources ===
+
=== Get the [[GnuCash Sources]] ===
For the very latest source code, get the sources from [[Git]] or use the latest release source file of type <tt>gnucash-<version>.tar.gz</tt> from [https://sourceforge.net/projects/gnucash/files/ Sourceforge]. '''Do not attempt to use tarballs from GitHub.''' Examine the [[Dependencies]] wiki page and the [https://github.com/Gnucash/gnucash/blob/master/README.dependencies README.dependencies] file for the list of build dependencies for your distribution, the [https://github.com/Gnucash/gnucash/blob/master/README.git README.git] file for notes on compiling gnucash, and the [https://github.com/Gnucash/gnucash/blob/master/HACKING HACKING] file for notes on hacking the code.
 
  
=== Building: Autotools ===
+
=== Configuring the Build Sytem ===
  
1. Change to gnucash directory
+
The GnuCash build system has gone through some changes in the course of the 2.6 and 2.7 series. Depending on the version of GnuCash you want to build you have the following options:
  cd gnucash
 
2. If this code was retrieved from [[Git]], generate the configure script (otherwise skip this step)
 
  ./autogen.sh
 
3. Look at available configure options
 
  ./configure --help
 
:(Note: There are issues with the ''guile'' configuration of ''slib'' which will cause ''configure'' to fail on many distributions. See: [[#slib Issues]])
 
  
4. For an "in-tree" build (where the compiled files are located in the same directories as the source code files), run configure with the appropriate options. Alternatively, create a separate build directory as explained below. Some example options for configure might look as follows
+
;For the application:
  ./configure --prefix=/opt/gnucash-devel \
+
:;GnuCash 2.7.4 and more recent: These versions can only be built using [[#CMake]]. Autotools support was removed.  
    --enable-debug --enable-doxygen \
+
:;GnuCash 2.6.13 until GnuCash 2.7.3:[[#CMake]] support was introduced in version 2.6.13. Until version 2.7.3 GnuCash can be built with either [[#CMake]] or [[#Autotools]].
    --enable-error-on-warning --enable-compile-warnings \
+
:;Earlier versions:Can only be built with [[#Autotools]].
    [--enable-ofx [...]]
+
:; Source Documentation requires Doxygen and is built with the command ```make doc```.
;--prefix: Where should the package be installed? If you install for test purposes, you might consider installing it below your home directory to avoid ''sudo''ing. You should never use the same path as your distribution!
+
; The GnuCash Help and Tutorial and Concept Guide are configured and built with Autotools only.
5. Compile and install
 
  make
 
:optional - if you changed something in the sources:
 
  make check
 
:If your prefix was below $HOME:
 
  make install
 
:else
 
  sudo make install
 
:Sudo will ask you for the administrator password.
 
  
6. Run
+
==== Compiler ====
  /opt/gnucash-devel/bin/gnucash [options]
+
GnuCash 3.x requires a C++ compiler that supports ISO-standards C11 and C++11. Gcc version >=4.8 and Clang version >= 3.3 are known to work.
:Again use the option ''--help'' to see a list.
 
  
==== Using separate build directory ====
+
For GnuCash 4.x (i.e. current master branch) we expect to require C++14 and may require C++17 compatibility.
It is possible, and even preferable, to separate the directories containing source code, build files, and installed files.
 
  
To build in another directory, cd to it before starting, then call the configure script by the relative path. For example:
+
==== CMake ====
cd gnucash
+
[https://cmake.org CMake] is a popular configuration and build system. One of its major advantages is the ability to generate project files for a variety of tools including make, ninja, CodeBlocks, [[Eclipse]], and Xcode.
./autogen.sh
+
[https://ninja-build.org Ninja] is particularly interesting because it is extremely efficient and highly parallel.
These steps were identical to the description above. Now the part which is different:
 
mkdir build        # Create the separate build directory
 
cd build
 
From within the build directory, you now have to call configure by its relative path. In this example, this is
 
../configure --prefix...   # and all the other options
 
  
Then you can run ''make'', and ''make install'' as normal.
+
'''Notes:'''
  
==== Reverse commands ====
+
* The following examples use <tt>gnucash.git</tt> as the name of the top source directory as would be the case if you used
In case you dislike your '''installation''', run from your build directory
+
  git clone https://github.com/gnucash/gnucash gnucash.git
[sudo] make uninstall
+
:to obtain the sources. The last part of that command is the name of the directory into which the gnucash sources are written. If you're building from a source tarball the directory will be named something like <tt>gnucash-3.0</tt>, with "3.0" being the version of the tarball. We'll use <tt>path/to/gnucash.git</tt> to represent the path to the source directory. Make the obvious substitution.
to remove it, ''before'' you change relevant options like the prefix.
+
* There is a subdirectory named <tt>gnucash</tt> inside the source directory. Make sure that you don't pass that directory as source directory to <tt>cmake</tt>.
  
To clean up your '''build''' directory, run
+
'''Procedure:'''
make clean
 
If you use a separate build directory, you can remove its content instead.
 
 
 
In some cases, that might not be sufficient, then clean your '''git''' gnucash directory with
 
git clean -f
 
 
 
To remove everything not part of the repo, including directories and ignored files, run
 
git clean -fdx -e /.project  -e /.cproject -e /.autotools -e /.settings/
 
'''Note:''' The exceptions are only necessary for Eclipse users. Else all their project information would be lost.
 
 
 
In this case you will have to start with ./autogen-sh again.
 
  
=== Building: CMake ===
+
# To configure GnuCash with cmake you'll first need to ensure that cmake and your chosen build toolchain are installed via the package manager; the [[MacOSX/Quartz]] and [[Windows]] build scripts take care of this for you.
[https://cmake.org CMake] is another popular configuration and build system. One of its major advantages is the ability to generate project files for a variety of tools including make, ninja, CodeBlocks, Eclipse, and Xcode.
+
# Next create a build directory. This is an arbitrary directory in which you will execute all commands related to the build. It should not be the source directory itself, but it can be a subdirectory (most people who do this creatively name it some variant of <tt>build</tt>) or it can be anywhere else that you have read and write permission, in which case you'll probably want to name it something like <tt>gnucash-build</tt>.
[https://ninja-build.org Ninja] is particularly interesting because it is extremely efficient and highly parallel.
+
# You'll also need to select an installation prefix. Unless you're packaging GnuCash for a distribution, avoid anything under <tt>/usr</tt> or <tt>/opt</tt>. Those are special directories generally owned by root and the first is reserved for the distribution packages. CMake knows this and will munge some of the paths, leading to unexpected results. In the examples below we've used $HOME/.local, a common hidden directory on linux systems that's often in the default path, but any subdirectory under $HOME will allow easy installation without requiring privilege escalation.
 +
# Next run cmake with some variable definitions from within the build directory:
 +
  cmake -D CMAKE_INSTALL_PREFIX=$HOME/.local path/to/gnucash.git
 +
::Will make a default configuration in the current directory from the sources in ../gnucash.git to be built with make. To build with ninja instead you'd use
 +
  cmake -G Ninja -D CMAKE_INSTALL_PREFIX=$HOME/.local path/to/gnucash.git
 +
::and to make a [https://cmake.org/cmake/help/v3.0/variable/CMAKE_BUILD_TYPE.html debug build]
 +
  cmake -DCMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=$HOME/local path/to/gnucash.git
  
To configure GnuCash with cmake you'll first need to ensure that cmake and your chosen build tool are installed. Users of the [[MacOSX/Quartz]] build instructions will find that cmake is already present, and users of the [[Windows]] build scripts will find both cmake and ninja can be installed by adding a couple of lines to <code>custom.sh</code>. Most others will be able to install both easily enough via their package managers.
+
'''Configuration Options:'''
  
Cmake configuration is done by running cmake with some variable definitions, for example:
+
GnuCash's cmake configuration is written to build most of the optional features by default. The only exception is the python bindings. See further down how you can alter this selection.
  cmake -D CMAKE_INSTALL_PREFIX=/opt/gnucash-devel ../gnucash.git
 
Will make a default configuration in the current directory from the sources in ../gnucash.git to be built with make. To build with ninja instead you'd use
 
  cmake -G Ninja -D CMAKE_INSTALL_PREFIX=/opt/gnucash-devel ../gnucash.git
 
and to make a debug build
 
  cmake -DCMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/opt/gnucash-devel ../gnucash.git
 
  
Unlike autotools, GnuCash's cmake configuration is written to build all of the standard optional features. Some other important variables that you may need to define:
+
Some other important variables that you may need to define:
* <code>CMAKE_PREFIX_PATH</code> declares a : (or ; on Windows) separated set of search paths for roots of include and library files, needed if some dependencies are not installed in the default locations, i.e. /usr and /usr/local on most Unix systems. For example if you've built some dependencies from source and installed them in /opt you'd need to use
+
* <code>CMAKE_PREFIX_PATH</code> declares a : separated (or ; separated on Windows) set of search paths for roots of include and library files, needed if some dependencies are not installed in the default locations, i.e. /usr and /usr/local on most Unix systems. For example if you've built some dependencies from source and installed them in $HOME/.local you'd need to use
   cmake -D CMAKE_INSTALL_PREFIX=/opt/gnucash-devel -D CMAKE_PREFIX_PATH=/opt ../gnucash.git
+
   cmake -D CMAKE_INSTALL_PREFIX=$HOME/.local -D CMAKE_PREFIX_PATH=$HOME/.local path/to/gnucash.git
 
* <code>GTEST_ROOT</code> and <code>GMOCK_ROOT</code> may be needed if cmake can't find Googletest in the normal locations for your distro.
 
* <code>GTEST_ROOT</code> and <code>GMOCK_ROOT</code> may be needed if cmake can't find Googletest in the normal locations for your distro.
* <code>GNC_DBD_DIR</code> The location of the DBD driver modules (e.g. libdbd-mysql.so) if not /usr/lib/dbd.
+
* <code>GNC_DBD_DIR</code> The location of the DBD driver modules (e.g. libdbd-mysql.so) if not in the standard system library path (classically /usr/lib/dbd, but might be something like /usr/lib64/dbd or /usr/lib/x86_64-linux-gnu/dbd depending you your distro).
 
* <code>TEST_MYSQL_URL</code>The complete URL including password for a MySQL test database for running the SQL backend tests with MySQL.
 
* <code>TEST_MYSQL_URL</code>The complete URL including password for a MySQL test database for running the SQL backend tests with MySQL.
 
* <code>TEST_PGSQL_URL</code>The complete URL including password for a PostgreSQL test database for running the SQL backend tests with PostgreSQL.
 
* <code>TEST_PGSQL_URL</code>The complete URL including password for a PostgreSQL test database for running the SQL backend tests with PostgreSQL.
  
Configuration options are also set using -D; for example, include <code>-D DISABLE_DEPRECATED_GLIB=ON</code> to configure the build to raise errors when attempting to compile functions marked as deprecated in the version of GLib you're using. The options and default values at the time of writing were:
+
Configuration options are also set using -D; for example, include <code>-D DISABLE_DEPRECATED_GLIB=ON</code> to configure the build to raise errors when attempting to compile functions marked as deprecated in the version of GLib you're using. The GnuCash options and default values at the time of writing were:
 
* <code>WITH_SQL</code>, ON, enable the SQL backends. Requires LibDBI.
 
* <code>WITH_SQL</code>, ON, enable the SQL backends. Requires LibDBI.
 
* <code>WITH_AQBANKING</code>, ON, enable the Online Banking features. Requires AQBanking, Gwenhywfar, and Ktoblzcheck.
 
* <code>WITH_AQBANKING</code>, ON, enable the Online Banking features. Requires AQBanking, Gwenhywfar, and Ktoblzcheck.
Line 110: Line 77:
 
Consult the root <code>CMakeLists.txt</code> in the GnuCash source directory for a current list of settings and options.
 
Consult the root <code>CMakeLists.txt</code> in the GnuCash source directory for a current list of settings and options.
  
Once cmake has completed its configuration you can run <code>make</code>, <code>make check</code>, or <code>make install</code> as usual. If you configured with <code>-G Ninja</code> you'd use <code>ninja</code>, <code>ninja check</code>, or <code>ninja install</code> instead.
+
'''Further Reading:'''
 +
 
 +
* http://www.cmake.org/Wiki/CMake_FAQ FAQ
 +
* http://www.cmake.org/HTML/Download.html - Download
 +
* http://www.cmake.org/HTML/Documentation.html - The same page which you also get by "man cmake".
 +
* http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/ - Potentially helpful additional macros
 +
* [https://samthursfield.wordpress.com/2015/11/21/cmake-dependencies-between-targets-and-files-and-custom-commands/ A blog post] about handling dependencies and targets for custom build commands.
 +
* [http://llvm.org/docs/CMakePrimer.html LLVM's CMake Primer], a more programmer-oriented tutorial than the one in the CMake documentation.
 +
 
 +
==== Autotools ====
 +
 
 +
The ''documentation'' gnucash-docs uses the Autotools build system.
 +
 
 +
'''Note:''' Autotools support has been removed from the ''program'' GnuCash as of version 2.7.4. Use [[#CMake|CMake]] instead.
 +
 
 +
1. Discouraged intree build:
  
'''Notes'''
+
1.1. Change to gnucash-docs directory
 +
  cd gnucash-docs
 +
1.2. If this code was retrieved from [[Git]], generate the configure script (otherwise skip this step)
 +
  ./autogen.sh
 +
1.3. Look at available configure options
 +
  ./configure --help
 +
 
 +
2. The build should happen in a separate directory either outside the source directory or a hidden directory in your source directory. This is to avoid known problems with intltool. For example:
 +
<Syntaxhighlight lang="sh">
 +
cd gnucash-docs
 +
./autogen.sh        # These steps were identical to the description above. Now the part which is different:
 +
mkdir .build        # Create the separate hidden build directory
 +
cd .build          # and enter it
 +
</Syntaxhighlight>
 +
From within the build directory, you now have to call configure by its relative path. In this example, this is
 +
<Syntaxhighlight lang="sh">
 +
../configure --prefix...    # and all your other options
 +
</Syntaxhighlight>
 +
Some example options for configure might look as follows
 +
  ../configure --prefix=/opt/gnucash-docs [...]
 +
;--prefix: Where should the package be installed? If you install for test purposes, you might consider installing it below your home directory to avoid ''sudo''ing. You should never use the same path as your distribution!
 +
 
 +
;Further reading/viewing:
 +
:[https://autotools.io/index.html Autotools Mythbuster]
 +
:[https://www.dwheeler.com/autotools/ Introduction to the Autotools] 36' video tutorial
 +
 
 +
=== Building ===
 +
 
 +
1. To compile the sources
 +
:* In case the build was configured with autotools or cmake/makefiles:
 +
  make
 +
:* In case the build was configured with cmake/Ninja:
 +
  ninja
 +
:: or
 +
  ninja-build
 +
:: Which one depends on the platform or distribution. Some package the tool as ninja, others package it as ninja-build. If one doesn't work, try the other.
 +
:: In all the commands the follow, only the make invocation will be shown. Replace make with ninja(-build) if your build was configured for Ninja.
 +
2. Optionally run the unit test suite. You should do this if you changed something in the sources:
 +
  make check
 +
3. To install gnucash
 +
:* If your prefix was a descendant of $HOME or any other location where your normal user has write access:
 +
  make install
 +
:* Otherwise
 +
  sudo make install
 +
:Depending on the settings of your system <code>sudo</code> will ask you for your or the administrators password and will only work if you have administrative privileges.
 +
 
 +
4. Run
 +
  /opt/gnucash-devel/bin/gnucash [options]
 +
:Again use the option ''--help'' to see a list.
 +
 
 +
==== Reverse commands ====
 +
In case you dislike your '''installation''', run from your build directory
 +
[sudo] make uninstall
 +
to remove it, ''before'' you change relevant options like the prefix.
  
* ninja does not have an <code>uninstall</code> target. To uninstall a ninja build run
+
'''Note''' ninja does not have an <code>uninstall</code> target. To uninstall a ninja build run
   xargs rm < install_manifest.txt
+
   [sudo] xargs rm < install_manifest.txt
 
from the root build directory.
 
from the root build directory.
* cmake builds do not use <code>libtool</code> and by default install ''compilation'' targets including test programs in a <code>bin</code> subdirectory of the root build directory, and all the libraries are built into a <code>lib</code> subdirectory with linkage temporarily set up so that the binaries can find their libraries, so to re-run a single test file you can simply run e.g.
+
 
 +
To clean up your '''build''' directory, run
 +
make clean
 +
If you use a separate build directory, you can remove its content instead.
 +
 
 +
In some cases, that might not be sufficient, then clean your '''git''' gnucash directory with
 +
git clean -f
 +
 
 +
To remove everything not part of the repo, including directories and ignored files, run
 +
git clean -fdx -e /.project  -e /.cproject -e /.autotools -e /.settings/
 +
'''Note:''' The exceptions are only necessary for Eclipse users. Else all their project information would be lost.
 +
 
 +
In this case you will have to start with ./autogen-sh again if you are using the autotools configuration.
 +
 
 +
'''Notes'''
 +
* cmake builds by default install ''compilation'' targets including test programs in a <code>bin</code> subdirectory of the root build directory, and all the libraries are built into a <code>lib[64]</code> subdirectory with linkage temporarily set up such that the binaries can find their libraries. So to re-run a single test file you can simply run e.g.
 
   bin/test-engine
 
   bin/test-engine
and to debug the same
+
and to debug
 
   gdb bin/test-engine
 
   gdb bin/test-engine
 
Scheme tests reside in directories that mirror their source directories and require some environment fiddling to get them to run outside of <code>make check</code> or <code>ninja check</code>.
 
Scheme tests reside in directories that mirror their source directories and require some environment fiddling to get them to run outside of <code>make check</code> or <code>ninja check</code>.
  
== Distro-specific Information ==
+
== Tutorial on Plugins ==
 +
This section describes how to build a plugin from scratch.
 +
 
 +
;Note:This information is using the [[#Autotools]] based build system although current versions of gnucash (as of 2.7.4) can only be built with [[#CMake]]. So this may require some reinterpretation.
 +
 
 +
A plugin is a runtime loadable module which provides optional functions for GnuCash. There are a couple of plugins plus a skeleton example in src/plugins. To add your own plugin:
 +
 
 +
* Copy the example to a new plugin subdirectory:
 +
  cd src/plugins
 +
  cp -R example your-plugin-name
 +
* edit Makefile.am to add your-plugin-name to the subdirs list
 +
* edit configure.ac, inserting the following line near the end just before AC_OUTPUT:
 +
  AC_CONFIG_FILES(src/plugins/your-plugin-name/Makefile src/plugins/your-plugin-name/ui/Makefile src/plugins/your-plugin-name/glade/Makefile)
 +
* edit the source files in your-plugin-name to actually do what you want, rename them to make sense, and adjust the filenames in the three Makefile.am to match.
 +
* Rebuild GnuCash:
 +
  cd ../..
 +
  ./autogen.sh
 +
  ./configure --whatever options you usually use
 +
  make
 +
  make install
 +
* to force GnuCash to load the plugin upon start
 +
  echo '(gnc:module-load "gnucash/plugins/your-plugin-name" 0)' >> ~/.gnucash/config.user
 +
 
 +
The result will be your new plugin being available in the Tools menu, or wherever you added it in the UI file.
 +
 
 +
== OS/Distro specific Information ==
 
See the [https://github.com/Gnucash/gnucash/blob/master/README.dependencies README.dependencies] file for library dependency notes.
 
See the [https://github.com/Gnucash/gnucash/blob/master/README.dependencies README.dependencies] file for library dependency notes.
 
Also check out [[Dependencies|the dependencies page]].
 
Also check out [[Dependencies|the dependencies page]].
 
=== Slackware ===
 
 
Slackware installation is covered on [[Slackware|this page]].
 
  
 
=== Debian ===
 
=== Debian ===
Line 153: Line 224:
 
  intltool
 
  intltool
 
  libtool
 
  libtool
 +
 +
=== Fedora ===
 +
==== Fedora 13 ====
 +
On Fedora 13, the build instructions are very similar to the ones for Ubuntu 10.04 (above). First, we need install all dependencies of building GnuCash.
 +
 +
sudo yum-builddep gnucash -y
 +
sudo yum install texinfo git intltool libdbi-devel libdbi guile guile-devel doxygen gtkhtml3-devel -y
 +
 +
And then we create the directories for source code, and check out source code from git master
 +
 +
mkdir -p ~/development
 +
cd ~/development
 +
git clone https://github.com/Gnucash/gnucash/ gnucash
 +
cd gnucash
 +
 +
Then, we build it by following commands:
 +
 +
./autogen.sh
 +
./configure --prefix=$HOME/unstable/gnucash --enable-debug --enable-doxygen --enable-error-on-warning --enable-compile-warnings
 +
make all install
 +
 +
If there are no errors, we can run it:
 +
 +
~/unstable/gnucash/bin/gnucash
 +
 +
==== Fedora 23 ====
 +
On Fedora 23, yum has been replaced with dnf. But other than that the instructions remain the same.
 +
First, we need install all dependencies of building GnuCash.
 +
 +
sudo dnf builddep gnucash -y
 +
sudo dnf install texinfo git intltool libdbi-devel guile-devel doxygen webkitgtk-devel -y
 +
 +
And then we create the directories for source code, and check out source code from git master
 +
 +
mkdir -p ~/development
 +
cd ~/development
 +
git clone https://github.com/Gnucash/gnucash/ gnucash
 +
cd gnucash
 +
 +
Then, we build it by following commands:
 +
 +
./autogen.sh
 +
./configure --prefix=$HOME/unstable/gnucash --enable-debug --enable-doxygen --enable-error-on-warning --enable-compile-warnings
 +
make all install
 +
 +
If there are no errors, we can run it:
 +
 +
~/unstable/gnucash/bin/gnucash
 +
 +
=== Gentoo ===
 +
 +
Gentoo instructions can be found on [[Gentoo|Gnucash-svn installation on Gentoo]].
 +
 +
=== Mac OS X ===
 +
 +
Mac OS X instructions can be found on [[MacOSX/Quartz]] (This is the procedure used for building the binary packages) or [[MacOSXInstallation| gnucash installation from source on Mac OS X]].
 +
 +
=== Microsoft Windows ===
 +
 +
Compiling GnuCash in Windows is possible, but much more difficult than in linux. For details, see [[Windows|GnuCash on Microsoft Windows]].
 +
 +
=== Slackware ===
 +
 +
Slackware installation is covered on [[Slackware|this page]].
  
 
=== Ubuntu ===
 
=== Ubuntu ===
Line 188: Line 323:
 
* If dpkg -i *.deb fails because it lists a bunch of dependencies (this happens if you've never installed gnucash before) the easiest way to get apt to bring them in is using -f (fix broken) install:  
 
* If dpkg -i *.deb fails because it lists a bunch of dependencies (this happens if you've never installed gnucash before) the easiest way to get apt to bring them in is using -f (fix broken) install:  
 
  sudo apt-get -f install
 
  sudo apt-get -f install
 +
 +
==== Ubuntu 16.04 LTS (Xenial Xerus) ====
 +
[[BuildUbuntu16.04 | Build Instructions for Ubuntu 16.04 also Ubuntu 18.04 & Linux Mint 18.3. ]]
  
 
==== Ubuntu 14.04 LTS (Trusty Tahr) ====
 
==== Ubuntu 14.04 LTS (Trusty Tahr) ====
Line 312: Line 450:
  
 
  ~/unstable/gnucash/bin/gnucash
 
  ~/unstable/gnucash/bin/gnucash
 
=== Gentoo ===
 
 
Gentoo instructions can be found on [[Gentoo|Gnucash-svn installation on Gentoo]].
 
 
=== Mac OS X ===
 
 
Mac OS X instructions can be found on [[MacOSX/Quartz]] (This is the procedure used for building the binary packages) or [[MacOSXInstallation| gnucash installation from source on Mac OS X]].
 
 
=== Fedora ===
 
==== Fedora 13 ====
 
On Fedora 13, the build instructions are very similar to the ones for Ubuntu 10.04 (above). First, we need install all dependencies of building GnuCash.
 
 
sudo yum-builddep gnucash -y
 
sudo yum install texinfo git intltool libdbi-devel libdbi guile guile-devel doxygen gtkhtml3-devel -y
 
 
And then we create the directories for source code, and check out source code from git master
 
 
mkdir -p ~/development
 
cd ~/development
 
git clone https://github.com/Gnucash/gnucash/ gnucash
 
cd gnucash
 
 
Then, we build it by following commands:
 
 
./autogen.sh
 
./configure --prefix=$HOME/unstable/gnucash --enable-debug --enable-doxygen --enable-error-on-warning --enable-compile-warnings
 
make all install
 
 
If there are no errors, we can run it:
 
 
~/unstable/gnucash/bin/gnucash
 
 
==== Fedora 23 ====
 
On Fedora 23, yum has been replaced with dnf. But other than that the instructions remain the same.
 
First, we need install all dependencies of building GnuCash.
 
 
sudo dnf builddep gnucash -y
 
sudo dnf install texinfo git intltool libdbi-devel guile-devel doxygen webkitgtk-devel -y
 
 
And then we create the directories for source code, and check out source code from git master
 
 
mkdir -p ~/development
 
cd ~/development
 
git clone https://github.com/Gnucash/gnucash/ gnucash
 
cd gnucash
 
 
Then, we build it by following commands:
 
 
./autogen.sh
 
./configure --prefix=$HOME/unstable/gnucash --enable-debug --enable-doxygen --enable-error-on-warning --enable-compile-warnings
 
make all install
 
 
If there are no errors, we can run it:
 
 
~/unstable/gnucash/bin/gnucash
 
 
=== slib Issues ===
 
 
Ubuntu Hardy and Intrepid, and if the mailing lists are to be believed, many other distributions as well, produce the following error when running the ''configure'' script:
 
 
:configure:27495: checking for SLIB support
 
:configure:27509: error:
 
 
::Cannot find SLIB.  Are you sure you have it installed?
 
::See http://bugzilla.gnome.org/show_bug.cgi?id=347922
 
::...
 
 
This is '''not''' a problem with gnucash!  The issue seems to be that the ''slib'' installation does not properly configure guile. Two items need to be fixed: a guile initialization file has an incorrect path, and the initialization of the slib catalog is not done. On Ubuntu, the initialization file is /usr/share/guile/1.8/ice-9/slib.scm. There is no guarantee that this will be the same on another distribution. This file references the guile.init file supplied by ''slib'' to hook slib into guile. Look in the file to find:
 
 
:(load-from-path "slib/guile.init")
 
 
This line must be changed to reflect the correct location of the guile.init file:
 
 
:(load-from-path "/usr/share/slib/init/guile.init")
 
 
This path is correct for Ubuntu. It will probably not be the same on other distributions. Once this is fixed, slib must be invoked from guile to initialize the catalog:
 
 
:sudo guile -c "(use-modules (ice-9 slib)) (require 'printf)"
 
 
Then, if there were no errors, the returned status will be "0". We can check this by echoing the status variable from the environment:
 
 
:echo $?
 
 
Which should return 0. If it does, then the configure script should now get past the section which checks for ''slib''. Note that since standard users probably do not have write permissions to the slib and guile directories, the catalog initialization will fail unless you sudo! I recently discovered (7/1/09) that upgrading Ubuntu from Hardy to Intrepid silently breaks slib by undoing this change, forcing you to repeat the fix.
 
 
Finally, there are several additional suggestions that can be gleaned from others who have had this problem. I've listed these below in case they are needed on some distributions. As far as I can tell, on Ubuntu at least, all of these additional actions are superfluous.
 
 
:'''Environment Strings:'''
 
 
::export SCM_INIT_PATH=/usr/share/slib/init/guile.init
 
::export SCHEME_LIBRARY_PATH=/usr/share/slib
 
::export GUILE_LOAD_PATH=/usr/share/guile/site /usr/share/guile/1.8 /usr/share/guile
 
 
:'''Symbolic Links:'''
 
 
::ln -s /usr/share/guile/1.8/ /usr/share/guile/site
 
::ln -s /usr/share/slib/ /usr/share/guile/1.8/slib
 
 
Obviously, the paths here refer to the Ubuntu install. Yours may differ.
 
 
== Tutorial on Plugins ==
 
This section describes how to build a plugin from scratch.
 
 
A plugin is a runtime loadable module which provides optional functions for GnuCash. There are a couple of plugins plus a skeleton example in src/plugins. To add your own plugin:
 
 
* Copy the example to a new plugin subdirectory:
 
  cd src/plugins
 
  cp -R example your-plugin-name
 
* edit Makefile.am to add your-plugin-name to the subdirs list
 
* edit configure.ac, inserting the following line near the end just before AC_OUTPUT:
 
  AC_CONFIG_FILES(src/plugins/your-plugin-name/Makefile src/plugins/your-plugin-name/ui/Makefile src/plugins/your-plugin-name/glade/Makefile)
 
* edit the source files in your-plugin-name to actually do what you want, rename them to make sense, and adjust the filenames in the three Makefile.am to match.
 
* Rebuild GnuCash:
 
  cd ../..
 
  ./autogen.sh
 
  ./configure --whatever options you usually use
 
  make
 
  make install
 
* to force GnuCash to load the plugin upon start
 
  echo '(gnc:module-load "gnucash/plugins/your-plugin-name" 0)' >> ~/.gnucash/config.user
 
 
The result will be your new plugin being available in the Tools menu, or wherever you added it in the UI file.
 
 
==Microsoft Windows==
 
 
Compiling GnuCash in Windows is possible, but much more difficult than in linux. For details, see [[Windows|GnuCash on Microsoft Windows]].
 

Revision as of 06:13, 14 June 2018

General Instructions

Disclaimer

This page deals with building the GnuCash from the source code. It includes building the current stable release from source code (downloaded tarballs as well as well as the developers version of GnuCash from the Git repository. If you are searching instructions for the stable versionavailable from your distributions software repositories, you should read GnuCash#Installation.

This page doesn't provide specific instructions for optional third-party modules like AqBanking or Perl Finance::Quote but does list the dependencies required and links to the configuration switches used with CMake to include them during compilation.

Get the GnuCash Sources

Configuring the Build Sytem

The GnuCash build system has gone through some changes in the course of the 2.6 and 2.7 series. Depending on the version of GnuCash you want to build you have the following options:

For the application
GnuCash 2.7.4 and more recent
These versions can only be built using #CMake. Autotools support was removed.
GnuCash 2.6.13 until GnuCash 2.7.3
#CMake support was introduced in version 2.6.13. Until version 2.7.3 GnuCash can be built with either #CMake or #Autotools.
Earlier versions
Can only be built with #Autotools.
Source Documentation requires Doxygen and is built with the command ```make doc```.
The GnuCash Help and Tutorial and Concept Guide are configured and built with Autotools only.

Compiler

GnuCash 3.x requires a C++ compiler that supports ISO-standards C11 and C++11. Gcc version >=4.8 and Clang version >= 3.3 are known to work.

For GnuCash 4.x (i.e. current master branch) we expect to require C++14 and may require C++17 compatibility.

CMake

CMake is a popular configuration and build system. One of its major advantages is the ability to generate project files for a variety of tools including make, ninja, CodeBlocks, Eclipse, and Xcode. Ninja is particularly interesting because it is extremely efficient and highly parallel.

Notes:

  • The following examples use gnucash.git as the name of the top source directory as would be the case if you used
 git clone https://github.com/gnucash/gnucash gnucash.git
to obtain the sources. The last part of that command is the name of the directory into which the gnucash sources are written. If you're building from a source tarball the directory will be named something like gnucash-3.0, with "3.0" being the version of the tarball. We'll use path/to/gnucash.git to represent the path to the source directory. Make the obvious substitution.
  • There is a subdirectory named gnucash inside the source directory. Make sure that you don't pass that directory as source directory to cmake.

Procedure:

  1. To configure GnuCash with cmake you'll first need to ensure that cmake and your chosen build toolchain are installed via the package manager; the MacOSX/Quartz and Windows build scripts take care of this for you.
  2. Next create a build directory. This is an arbitrary directory in which you will execute all commands related to the build. It should not be the source directory itself, but it can be a subdirectory (most people who do this creatively name it some variant of build) or it can be anywhere else that you have read and write permission, in which case you'll probably want to name it something like gnucash-build.
  3. You'll also need to select an installation prefix. Unless you're packaging GnuCash for a distribution, avoid anything under /usr or /opt. Those are special directories generally owned by root and the first is reserved for the distribution packages. CMake knows this and will munge some of the paths, leading to unexpected results. In the examples below we've used $HOME/.local, a common hidden directory on linux systems that's often in the default path, but any subdirectory under $HOME will allow easy installation without requiring privilege escalation.
  4. Next run cmake with some variable definitions from within the build directory:
 cmake -D CMAKE_INSTALL_PREFIX=$HOME/.local path/to/gnucash.git
Will make a default configuration in the current directory from the sources in ../gnucash.git to be built with make. To build with ninja instead you'd use
 cmake -G Ninja -D CMAKE_INSTALL_PREFIX=$HOME/.local path/to/gnucash.git
and to make a debug build
 cmake -DCMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=$HOME/local path/to/gnucash.git

Configuration Options:

GnuCash's cmake configuration is written to build most of the optional features by default. The only exception is the python bindings. See further down how you can alter this selection.

Some other important variables that you may need to define:

  • CMAKE_PREFIX_PATH declares a : separated (or ; separated on Windows) set of search paths for roots of include and library files, needed if some dependencies are not installed in the default locations, i.e. /usr and /usr/local on most Unix systems. For example if you've built some dependencies from source and installed them in $HOME/.local you'd need to use
 cmake -D CMAKE_INSTALL_PREFIX=$HOME/.local -D CMAKE_PREFIX_PATH=$HOME/.local path/to/gnucash.git
  • GTEST_ROOT and GMOCK_ROOT may be needed if cmake can't find Googletest in the normal locations for your distro.
  • GNC_DBD_DIR The location of the DBD driver modules (e.g. libdbd-mysql.so) if not in the standard system library path (classically /usr/lib/dbd, but might be something like /usr/lib64/dbd or /usr/lib/x86_64-linux-gnu/dbd depending you your distro).
  • TEST_MYSQL_URLThe complete URL including password for a MySQL test database for running the SQL backend tests with MySQL.
  • TEST_PGSQL_URLThe complete URL including password for a PostgreSQL test database for running the SQL backend tests with PostgreSQL.

Configuration options are also set using -D; for example, include -D DISABLE_DEPRECATED_GLIB=ON to configure the build to raise errors when attempting to compile functions marked as deprecated in the version of GLib you're using. The GnuCash options and default values at the time of writing were:

  • WITH_SQL, ON, enable the SQL backends. Requires LibDBI.
  • WITH_AQBANKING, ON, enable the Online Banking features. Requires AQBanking, Gwenhywfar, and Ktoblzcheck.
  • WITH_GNUCASH, ON, builds the Gnome GUI. Requires Gtk+ and its dependencies.
  • WITH_CUTECASH, OFF, builds the experimental and incomplete Qt GUI.
  • WITH_OFX, ON, builds the OFX importer code. Requires LibOFX and its dependencies.
  • WITH_PYTHON, OFF, builds the Python bindings and console. Requires Python 2.7 headers and library.
  • ENABLE_BINRELOC, ON, enables the built GnuCash to be moved to a different path from CMAKE_INSTALL_PREFIX after it's been built.
  • ENABLE_DEBUG, OFF, the same as CMAKE_BUILD_TYPE=Debug.
  • ENABLE_REGISTER2, OFF, builds the not-quite-finished GtkTreeView register replacement.
  • DISABLE_NLS, OFF, turns off generating translation calls for strings.
  • DISABLE_DEPRECATED_GLIB, OFF, raises an error when deprecated GLib functions are encountered.
  • DISABLE_DEPRECATED_GTK, OFF, raises an error when deprecated Gtk, Gdk, or GdkPixbuf functions are encountered.
  • DISABLE_DEPRECATED_GNOME, OFF, raises an error when deprecated functions in other Gnome libraries are encountered.
  • GNC_BUILD_AS_INSTALL, ON, Mirrors the installation layout instead of the source layout for final build products.

Consult the root CMakeLists.txt in the GnuCash source directory for a current list of settings and options.

Further Reading:

Autotools

The documentation gnucash-docs uses the Autotools build system.

Note: Autotools support has been removed from the program GnuCash as of version 2.7.4. Use CMake instead.

1. Discouraged intree build:

1.1. Change to gnucash-docs directory

 cd gnucash-docs

1.2. If this code was retrieved from Git, generate the configure script (otherwise skip this step)

 ./autogen.sh 

1.3. Look at available configure options

 ./configure --help

2. The build should happen in a separate directory either outside the source directory or a hidden directory in your source directory. This is to avoid known problems with intltool. For example:

cd gnucash-docs
./autogen.sh        # These steps were identical to the description above. Now the part which is different:
mkdir .build        # Create the separate hidden build directory
cd .build           # and enter it

From within the build directory, you now have to call configure by its relative path. In this example, this is

../configure --prefix...    # and all your other options

Some example options for configure might look as follows

 ../configure --prefix=/opt/gnucash-docs [...]
--prefix
Where should the package be installed? If you install for test purposes, you might consider installing it below your home directory to avoid sudoing. You should never use the same path as your distribution!
Further reading/viewing
Autotools Mythbuster
Introduction to the Autotools 36' video tutorial

Building

1. To compile the sources

  • In case the build was configured with autotools or cmake/makefiles:
 make
  • In case the build was configured with cmake/Ninja:
 ninja
or
 ninja-build
Which one depends on the platform or distribution. Some package the tool as ninja, others package it as ninja-build. If one doesn't work, try the other.
In all the commands the follow, only the make invocation will be shown. Replace make with ninja(-build) if your build was configured for Ninja.

2. Optionally run the unit test suite. You should do this if you changed something in the sources:

 make check

3. To install gnucash

  • If your prefix was a descendant of $HOME or any other location where your normal user has write access:
 make install
  • Otherwise
 sudo make install
Depending on the settings of your system sudo will ask you for your or the administrators password and will only work if you have administrative privileges.

4. Run

 /opt/gnucash-devel/bin/gnucash [options]
Again use the option --help to see a list.

Reverse commands

In case you dislike your installation, run from your build directory

[sudo] make uninstall

to remove it, before you change relevant options like the prefix.

Note ninja does not have an uninstall target. To uninstall a ninja build run

 [sudo] xargs rm < install_manifest.txt

from the root build directory.

To clean up your build directory, run

make clean

If you use a separate build directory, you can remove its content instead.

In some cases, that might not be sufficient, then clean your git gnucash directory with

git clean -f

To remove everything not part of the repo, including directories and ignored files, run

git clean -fdx -e /.project  -e /.cproject -e /.autotools -e /.settings/

Note: The exceptions are only necessary for Eclipse users. Else all their project information would be lost.

In this case you will have to start with ./autogen-sh again if you are using the autotools configuration.

Notes

  • cmake builds by default install compilation targets including test programs in a bin subdirectory of the root build directory, and all the libraries are built into a lib[64] subdirectory with linkage temporarily set up such that the binaries can find their libraries. So to re-run a single test file you can simply run e.g.
 bin/test-engine

and to debug

 gdb bin/test-engine

Scheme tests reside in directories that mirror their source directories and require some environment fiddling to get them to run outside of make check or ninja check.

Tutorial on Plugins

This section describes how to build a plugin from scratch.

Note
This information is using the #Autotools based build system although current versions of gnucash (as of 2.7.4) can only be built with #CMake. So this may require some reinterpretation.

A plugin is a runtime loadable module which provides optional functions for GnuCash. There are a couple of plugins plus a skeleton example in src/plugins. To add your own plugin:

  • Copy the example to a new plugin subdirectory:
 cd src/plugins
 cp -R example your-plugin-name
  • edit Makefile.am to add your-plugin-name to the subdirs list
  • edit configure.ac, inserting the following line near the end just before AC_OUTPUT:
 AC_CONFIG_FILES(src/plugins/your-plugin-name/Makefile src/plugins/your-plugin-name/ui/Makefile src/plugins/your-plugin-name/glade/Makefile)
  • edit the source files in your-plugin-name to actually do what you want, rename them to make sense, and adjust the filenames in the three Makefile.am to match.
  • Rebuild GnuCash:
 cd ../..
 ./autogen.sh
 ./configure --whatever options you usually use
 make
 make install
  • to force GnuCash to load the plugin upon start
 echo '(gnc:module-load "gnucash/plugins/your-plugin-name" 0)' >> ~/.gnucash/config.user

The result will be your new plugin being available in the Tools menu, or wherever you added it in the UI file.

OS/Distro specific Information

See the README.dependencies file for library dependency notes. Also check out the dependencies page.

Debian

If you are lucky, running

 aptitude build-dep gnucash

will install everything you need to build gnucash.

On Debian, the packages you'll probably need are (among many others):

guile-1.8-dev
swig
goffice-0-dev
libgsf-1-dev
libwebkitgtk-dev
libofx-dev (to enable ofx support)
libaqbanking16-dev (to enable aqbanking support. Don't use the newer libaqbanking20-dev - see AqBanking#Compatibility)
postgresql-dev (to enable sql support)

If you are building from git, you will also need the following installed before running autogen.sh:

automake
intltool
libtool

Fedora

Fedora 13

On Fedora 13, the build instructions are very similar to the ones for Ubuntu 10.04 (above). First, we need install all dependencies of building GnuCash.

sudo yum-builddep gnucash -y
sudo yum install texinfo git intltool libdbi-devel libdbi guile guile-devel doxygen gtkhtml3-devel -y

And then we create the directories for source code, and check out source code from git master

mkdir -p ~/development
cd ~/development
git clone https://github.com/Gnucash/gnucash/ gnucash
cd gnucash

Then, we build it by following commands:

./autogen.sh
./configure --prefix=$HOME/unstable/gnucash --enable-debug --enable-doxygen --enable-error-on-warning --enable-compile-warnings
make all install

If there are no errors, we can run it:

~/unstable/gnucash/bin/gnucash

Fedora 23

On Fedora 23, yum has been replaced with dnf. But other than that the instructions remain the same. First, we need install all dependencies of building GnuCash.

sudo dnf builddep gnucash -y
sudo dnf install texinfo git intltool libdbi-devel guile-devel doxygen webkitgtk-devel -y

And then we create the directories for source code, and check out source code from git master

mkdir -p ~/development
cd ~/development
git clone https://github.com/Gnucash/gnucash/ gnucash
cd gnucash

Then, we build it by following commands:

./autogen.sh
./configure --prefix=$HOME/unstable/gnucash --enable-debug --enable-doxygen --enable-error-on-warning --enable-compile-warnings
make all install

If there are no errors, we can run it:

~/unstable/gnucash/bin/gnucash

Gentoo

Gentoo instructions can be found on Gnucash-svn installation on Gentoo.

Mac OS X

Mac OS X instructions can be found on MacOSX/Quartz (This is the procedure used for building the binary packages) or gnucash installation from source on Mac OS X.

Microsoft Windows

Compiling GnuCash in Windows is possible, but much more difficult than in linux. For details, see GnuCash on Microsoft Windows.

Slackware

Slackware installation is covered on this page.

Ubuntu

Ubuntu releases are supported for various lengths of time; Wikipedia has a handy chart showing which versions are still supported.

Note: Dear Ubunteros, please do not copy and paste whole paragraphs. Instead adjust single sections in the form

Version x and newer:
do this
Version x-1 and before:
do that.
Can someone of you clean up this chapter and later remove this note?

Compiling Newer Ubuntu Packages on an Older Release ("self-backporting")

If you are on an older version of Ubuntu (or Debian for that matter) such as Trusty 14.04 LTS, you may be able to compile a newer Ubuntu or Debian version yourself (essentially backporting it yourself).

If the newer package is available in Utopic 14.10, add a line in your /etc/apt/sources.list (or for newer versions of Ubuntu, include a new file in the /etc/apt/sources.list.d/ directory) with the correct format. For Utopic, the line would be:

deb-src http://archive.ubuntu.com/ubuntu utopic main restricted universe

You want the version (Utopic in above example) to be newer than the system release you have installed. Then you can use the following lines to compile and install whatever software version is in the newer Ubuntu release, "backporting" the newer software to your older release of Ubuntu.

cd ~/src/
sudo aptitude update
sudo apt-get install build-essential fakeroot
sudo apt-get build-dep gnucash
apt-get --compile source gnucash
sudo dpkg -i *.deb

Easy as 1-2-3!*

  • If apt-get build-dep fails on the gnucash packages with a message like "E: Build-Depends dependency for gnucash cannot be satisfied because the package XXXXX cannot be found" then that means you need additional updated libraries on your system in order to backport the software. Unless you know there are only one or two new libraries needed, it's most likely MUCH easier just to build GnuCash from source. (See directions below.)
  • If dpkg -i *.deb fails because it lists a bunch of dependencies (this happens if you've never installed gnucash before) the easiest way to get apt to bring them in is using -f (fix broken) install:
sudo apt-get -f install

Ubuntu 16.04 LTS (Xenial Xerus)

Build Instructions for Ubuntu 16.04 also Ubuntu 18.04 & Linux Mint 18.3.

Ubuntu 14.04 LTS (Trusty Tahr)

To build from the source tarball download the source code tarball from http://www.gnucash.org/download.phtml and extract to an appropriate directory.

Next install the build dependencies

sudo apt-get build-dep gnucash

(On a fresh install I also needed to purge guile-2.0 and install these packages as well follow the guide below for issues with slib)

sudo apt-get purge guile-2.0
sudo apt-get install slib libgnomeui-common libgnomeui-dev guile-1.8 guile-1.8-dev checkinstall

if want to use the alternative database backends then:

sudo apt-get install libdbd-{sqlite3,pgsql,mysql}

In a terminal cd to the gnucash directory and run

./configure --prefix=/path/to/install/gnucash/to --enable-compile-warnings --with-html-engine=webkit
make
sudo checkinstall

The prefix might be, for example,

--prefix=/usr/bin/gnucash2.4

Running checkinstall will ask you some options on how the package is named, etc. This will produce a .DEB which you can then simply install (adjust the path/filename accordingly)

sudo dpkg -i /path/to/deb/gnucash_2.4.15-1_amd64.deb

Ubuntu 12.04 LTS (Precise Pangolin)

To build using the git repository first install git

sudo apt-get install git

then in an appropriate directory run

git clone  git://github.com/Gnucash/gnucash.git gnucash

which will make a git repository in a directory gnucash.

Next install the build dependencies

sudo apt-get build-dep gnucash

and a few required or useful tools

sudo apt-get install libtool swig git libgnomeui-dev xsltproc libxslt-dev doxygen

if want to use the alternative database backends then:

sudo apt-get install libdbd-{sqlite3,pgsql,mysql}

In a terminal cd to the gnucash directory and checkout the version that you want, so to get the latest 2.4 branch version:

git checkout 2.4

or to build a released version, for example:

git checkout 2.4.9

Then to build it

./autogen.sh
./configure --prefix=/path/to/install/to/gnucash --enable-compile-warnings --with-html-engine=webkit --disable-error-on-warning
make
sudo make install

The prefix might be, for example,

--prefix=/usr/bin/gnucash2.4

Then to run it, assuming there were no errors

/usr/bin/gnucash2.4/bin/gnucash

Ubuntu 11.10 (Oneiric Ocelot)

To build using the git repository first install git-core

sudo apt-get install git-core

then in an appropriate directory run

git clone  git://github.com/Gnucash/gnucash.git gnucash

which will make a git repository in a directory gnucash.

Next install the build dependencies

sudo apt-get build-dep gnucash

and a few required or useful tools

sudo apt-get install libtool swig git

if want to use the alternative database backends then:

sudo apt-get install libdbd-{sqlite3,pgsql,mysql}

In a terminal cd to the gnucash directory and checkout the version that you want, so to get the latest 2.4 branch version:

git checkout 2.4

or to build a released version, for example:

git checkout 2.4.7

Then to build it

./autogen.sh
./configure --prefix=/path/to/install/to/gnucash --enable-compile-warnings --with-html-engine=webkit
make
sudo make install

The prefix might be, for example,

--prefix=/usr/bin/gnucash2.4

Then to run it, assuming there were no errors

/usr/bin/gnucash2.4/bin/gnucash

Ubuntu 10.10 (Maverick Meerkat)

Follow the steps described for #Ubuntu 10.04 LTS (Lucid Lynx).

Ubuntu 10.04 LTS (Lucid Lynx)

First, we need install all dependencies of building GnuCash.

sudo aptitude build-dep gnucash
sudo aptitude install texinfo git intltool libdbi0-dev libdbd-{sqlite3,pgsql,mysql} guile-1.8 guile-1.8-dev doxygen libwebkit-dev

Since Ubuntu/Debian doesn't have guile-1.8-slib, which is actually just a softlink to slib, we create the softlink and generate the catalog manually.

cd /usr/share/guile/1.8
sudo ln -s ../../slib slib
sudo guile -c "(use-modules (ice-9 slib)) (require 'new-catalog)"

And then we create the directories for source code and installation, and check out source code from git master

mkdir -p ~/unstable ~/development
rm -rf ~/unstable/gnucash ~/development/gnucash
cd ~/development
git clone https://github.com/Gnucash/gnucash/ gnucash
cd gnucash

Then, we build it by following commands:

./autogen.sh
./configure --prefix=$HOME/unstable/gnucash --enable-debug --enable-doxygen --enable-error-on-warning --enable-compile-warnings
make all install

If there are no errors, we can run it:

~/unstable/gnucash/bin/gnucash