Difference between revisions of "Building"

From GnuCash
Jump to: navigation, search
m (Ubuntu 12.04 (Precise Pangolin))
m (>= -> ≥)
 
(136 intermediate revisions by 19 users not shown)
Line 1: Line 1:
== General Instructions ==
+
{| class="wikitable" style="margin: auto;"
 +
! scope="row"|Languages
 +
| [[de/{{PAGENAME:Gnucash}}|Deutsch]]
 +
| [[He/{{PAGENAME:בניה}}|עִברִית]]
 +
|}
 +
This page deals with building GnuCash '''from the source code'''. It includes building the current ''stable release'' from source code (downloaded as tarballs) as well as the ''developers version'' of GnuCash from the ''[[Git]] repository''. If you are searching for instructions for the version available '''from your distribution''''s software repositories, you should read [[Installation]].
  
===Disclaimer===
+
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.
This page deals with building the '''developers version''' of GnuCash from the ''Subversion repository''. If you are searching instructions for the ''stable version'', you should read [[GnuCash#Installation]].
 
  
This page deals also not with optional modules of third parties like the Perl module Finance::Quote.
+
== Introduction ==
 +
GnuCash can be built from sources on Linux distributions, Microsoft Windows and macOS. There are three major steps in building the GnuCash program. These are listed along with the tools which may used for each step:
  
===Get and Configure the Sources===
+
# Configuration (cmake - autotools in earlier GnuCash versions)
For the very latest source code, [[Subversion|get the sources from Subversion]] (but you need to think about the appropriate branch: 2.4 or trunk); alternatively, use the latest release source file of type <tt>gnucash-<version>.tar.gz</tt>. Examine the [[Dependencies]] wiki page and the [http://svn.gnucash.org/trac/file/gnucash/trunk/README.dependencies README.dependencies] file for the list of build dependencies for your distribution, the [http://svn.gnucash.org/trac/file/gnucash/trunk/README.svn README.svn] file for notes on compiling gnucash, and the [http://svn.gnucash.org/trac/file/gnucash/trunk/HACKING HACKING] file for notes on hacking the code.
+
# Compilation ( make or ninja)
 +
# Installation (make or ninja)
  
Here are the basic steps one might end up taking:
+
Building GnuCash utilizes a set of tools which is available for all three of the major operating systems.
 +
These steps are described in detail for each operating system in the linked pages below, along with the installation of the build tools.
  
1. Change to gnucash directory
+
== Build Tools ==
  cd gnucash
+
A general description of the tools used to configure and build GnuCash is given in [[Build_Tools |Build tools]].
2. If this code was retrieved from [[Subversion|SVN]], 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
+
A listing of dependencies is available at [[Dependencies]].
  ./configure --prefix=/opt/gnucash-devel \
 
    --enable-debug --enable-doxygen \
 
    --enable-error-on-warning --enable-compile-warnings \
 
    [--enable-ofx [...]]
 
5. Compile and install
 
  make
 
  make install
 
6. Run
 
  /opt/gnucash-devel/bin/gnucash
 
  
=== Using separate build directory ===
+
The GnuCash build system has gone through some changes in the course of the 2.6 and 3 series. CMake has replaced the Autotools autogen and configure scripts for configuring the build. This has provided the ability to configure for alternative build systems and popular IDEs. Under the hood compilation and installation can now either be controlled using GNU [[Build_Tools#Make|Make]] or alternatively using the faster [[Build_Tools#Ninja|Ninja]]. Depending on the version of GnuCash you want to build you have the following options:
It is possible, and even preferable, to separate the directories containing source code, build files, and installed files.
+
;For the application generally:
 +
:;GnuCash 3 and more recent: These versions are configured using [[Build_Tools#CMake|CMake]]. Autotools support has been removed. Either make or ninja may be used for the build.
 +
:;GnuCash 2.6 and earlier: These versions are configured with [[Build_Tools#Autotools|Autotools]] and built with the GNU make utility. GnuCash from v2.6.13 allowed experimental use of cmake to configure and ninja to build.
  
To build in another directory, cd to it before starting, then call the configure script by the relative path. For example:
+
;For the Source API Documentation: This is built directly from the program sources. Depending on how the build system is configured you can use <code>make doc</code> or <code>ninja doc</code>. Note this requires [[Doxygen]] to be installed.
cd gnucash
 
./autogen.sh
 
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.
+
;For the documentation:
 +
:;Since GnuCash 4.8: Only [[Build_Tools#CMake|CMake]] with either [[Build_Tools#Make|Make]] or [[Build_Tools#Ninja|Ninja]] is supported
 +
:;Upto GnuCash 4.7: The GnuCash Help and Tutorial and Concept Guide are configured with [[Build_Tools#Autotools|Autotools]] and built with [[Build_Tools#Make|Make]].
 +
::[[Build_Tools#CMake|CMake]] was introduced in 3.7.
  
== Distro-specific Information ==
+
== Compiler ==
See the [http://svn.gnucash.org/trac/file/gnucash/trunk/README.dependencies README.dependencies] file for library dependency notes.
+
'''GnuCash &ge; 4.0''' requires ISO-standard '''C++17''' compatibility.
Also check out [[Dependencies|the dependencies page]].
 
  
=== Debian ===
+
'''GnuCash 3.x''' required a C++ compiler that supports ''C11'' and ''C++11''. '''Gcc version &ge; 4.8''' and '''Clang version &ge; 3.3''' are known to work.
  
If you are lucky, running
+
== Source Platform ==
  aptitude build-dep gnucash
+
=== Building on Linux Distributions ===
will install everything you need to build gnucash.
+
Detailed instructions for building GnuCash on Linux distributions can be found on [[Building_On_Linux | Building On Linux]].
  
On Debian, the packages you'll probably need are (among many others):
+
=== Building on macOS ===
 +
macOS instructions can be found on [[MacOS/Quartz]] (This is the procedure used for building the binary packages)  
 +
or [[MacOS Installation| GnuCash installation from source on macOS]].
  
guile-1.6-dev
+
=== Building on Microsoft Windows ===
swig
+
Compiling GnuCash on Windows is possible, but much more difficult than on Linux.  
libgnome2-dev
+
For details, see [[Building on Windows|building GnuCash on Microsoft Windows]].
libgnomeui-dev
 
goffice-0-dev
 
libgsf-1-dev
 
libgtkhtml3.2-dev (3.6, 3.8, or 3.14 will also do)
 
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 svn, you will also need the following installed before running autogen.sh:
 
 
 
automake
 
intltool
 
libtool
 
guile-1.6-dev
 
 
 
For the 2.0-branch of GnuCash you need additionally:
 
libgwrapguile-dev OR
 
guile-g-wrap
 
 
 
If you see the error "<unnamed port>: no code for module (g-wrap gw standard)" at runtime, see
 
[[FAQ#Q: Running 2.0.x on Debian/Ubuntu crashes with "no code for module (g-wrap gw standard)". What does this mean?|this particular FAQ]].
 
 
 
=== Ubuntu ===
 
 
 
Ubuntu releases are supported for various lengths of time; Wikipedia has a [http://en.wikipedia.org/wiki/List_of_Ubuntu_releases#Release_history handy chart showing which versions are still supported].
 
 
 
==== 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 Lucid with long-term support and need certain packages that are not available from the [http://packages.ubuntu.com/lucid-backports/ lucid-backports] do not fret.  You can easily compile them yourself (essentially backporting them).  Make sure you have a line of the form
 
 
 
deb-src http://archive.ubuntu.com/ubuntu maverick main restricted universe
 
 
 
in your /etc/apt/sources.list.  You want the version (Maverick in above example) to be at least one release higher than what you have installed.  Then you can use the following lines to compile and install any software version that you need but is missing from the official repositories for the release you run.
 
 
 
cd /usr/src
 
sudo aptitude build-dep ''$packageyouwant''
 
apt-get --compile source ''$packageyouwant''
 
dpkg -i ''$packageyouwant''.deb
 
 
 
Easy as 1-2-3!
 
 
 
==== Ubuntu 12.04 (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.
 
 
 
The main branch in git is conventionally named master, whereas in this repository it is named trunk (due to the fact that it is derived from a subversion repository I believe). This is not a problem but if you would rather have it named master then cd into the gnucash directory and
 
 
 
git branch -t master refs/remotes/origin/trunk
 
git checkout master
 
 
 
Next install the build dependencies
 
sudo apt-get build-dep gnucash
 
and a few required or useful tools
 
sudo apt-get install libtool swig subversion libgnomeui-dev xsltproc
 
 
 
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
 
 
 
If you want to use one of the database backends then include --enable-dbi in configure.
 
 
 
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.
 
 
 
The main branch in git is conventionally named master, whereas in this repository it is named trunk (due to the fact that it is derived from a subversion repository I believe). This is not a problem but if you would rather have it named master then cd into the gnucash directory and
 
 
 
git branch -t master refs/remotes/origin/trunk
 
git checkout master
 
 
 
Next install the build dependencies
 
sudo apt-get build-dep gnucash
 
and a few required or useful tools
 
sudo apt-get install libtool swig subversion
 
 
 
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
 
 
 
If you want to use one of the database backends then include --enable-dbi in configure.
 
 
 
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) ====
 
 
 
The instructions is very similar to Ubuntu 9.10.
 
 
 
First, we need install all dependencies of building GnuCash.
 
 
 
sudo aptitude build-dep gnucash
 
sudo aptitude install texinfo subversion 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 SVN trunk:
 
 
 
mkdir -p ~/unstable ~/development
 
rm -rf ~/unstable/gnucash ~/development/gnucash
 
cd ~/development
 
svn co http://svn.gnucash.org/repo/gnucash/trunk 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 is no any errors, we can run it:
 
 
 
~/unstable/gnucash/bin/gnucash
 
 
 
==== Ubuntu 9.10 (Karmic Koala) ====
 
 
 
the same instructions apply as for 9.04, except that the dependencies have changed
 
 
 
sudo aptitude install build-essential devscripts fakeroot libaqbanking29-dev aqbanking29-plugins*
 
sudo aptitude build-dep gnucash
 
sudo aptitude install gettext texinfo subversion autoconf libgconf2-dev libxml++2.6-dev intltool libtool swig \
 
slib guile-1.6-slib guile-1.6-dev doxygen libgtk2.0-dev libgnomeui-dev libglade2-dev libgoffice-0-8-dev \
 
libgtkhtml3.14-dev libofx-dev libfinance-quote-perl libdate-manip-perl
 
 
 
The above will allow GnuCash to be built, with or without libaqbanking support. If it is required to build libaqbanking itself the this is also required:
 
 
 
sudo aptitude build-dep libaqbanking
 
 
 
If building version 2.2.9 a compile error is generated if libgoffice-0-8-dev is installed (goffice/graph/gog-style.h: No such file or directory).  To avoid this uninstall libgoffice-0-8-dev (only) and install libgoffice-0-dev instead.  Gnucash version 2.3.x can still be built with the replacement package installed.
 
 
 
==== Ubuntu 9.04 (Jaunty Jackalope) ====
 
 
 
The following commands will download and compile the latest version of gnucash (trunk) source to a brand-new installation of Ubuntu 9.04.
 
 
 
On a clean installation of 9.04, a few packages (and their dependencies) need to be installed prior to building gnucash from source.  The packages here will also enable downloading stock quotes and importing ofx files.
 
sudo aptitude install gettext texinfo subversion autoconf \
 
  libgconf2-dev libxml++2.6-dev intltool libtool swig \
 
  slib guile-1.6-slib guile-1.6-dev doxygen libgtk2.0-dev \
 
  libgnomeui-dev libglade2-dev libgoffice-0-6-dev \
 
  libgtkhtml3.14-dev libofx-dev libfinance-quote-perl libdate-manip-perl
 
 
 
Now create the necessary directories, clear out any old source code, download the latest gnucash source via svn, and compile.
 
mkdir -p $HOME/unstable $HOME/development
 
rm -rf $HOME/unstable/gnucash $HOME/development/gnucash
 
cd $HOME/development
 
svn checkout http://svn.gnucash.org/repo/gnucash/trunk gnucash
 
cd gnucash
 
./autogen.sh
 
./configure --prefix=$HOME/unstable/gnucash --enable-debug --enable-doxygen --enable-error-on-warning --enable-compile-warnings
 
make all install
 
 
 
To enable database support, you will need to install the DBI development files, install an appropriate driver, and enable support during configuration:
 
sudo aptitude install libdbi0-dev libdbd-{sqlite3,pgsql,mysql}
 
./configure [options as above] --enable-dbi
 
./make all install
 
 
 
Now, assuming there were no errors during configure/build, fire it up!
 
~/unstable/gnucash/bin/gnucash
 
 
 
==== Ubuntu 8.04 LTS (Hardy Heron) ====
 
 
 
The build instructions provided for Ubuntu 7.04 (Feisty Fawn) are reported to work with GnuCash 2.2.9.
 
 
 
==== Ubuntu 7.10 (Gutsy Gibbon) ====
 
 
 
See [[BuildGutsy]]
 
 
 
==== Ubuntu 7.04 (Feisty Fawn) ====
 
'''Get Dependencies'''
 
sudo aptitude install build-essential checkinstall guile-1.6-dev guile-1.6-slib libgoffice-0-dev libgtkhtml3.14-dev texinfo gettext intltool libtool swig libofx-dev
 
 
 
'''Get GnuCash 2.2 Source'''
 
wget <nowiki>http://www.gnucash.org/pub/gnucash/sources/stable/gnucash-2.2.9.tar.gz</nowiki>
 
tar zxvf gnucash-2.2.9.tar.gz
 
cd gnucash-2.2.9
 
 
 
'''Create make files (only if checking out from SVN)'''
 
./autogen.sh
 
 
 
'''Configure'''
 
./configure
 
If this command complains about not finding libraries (it shouldn't), then you can probably find them in Synaptic.
 
 
 
'''Build .deb for GnuCash 2.2'''
 
checkinstall --default --install=no
 
This will take maybe 10 minutes, and it will build an installer file called  "gnucash_2.2.9-1_i386.deb".
 
(If it's got a different name, substitute that into the next step.)
 
 
 
'''Install the .deb that you built'''
 
sudo dpkg -i gnucash_2.2.9-1_i386.deb
 
If you get errors about dpkg not being able to overwrite files (I did), you can override them with this version:
 
sudo dpkg -i --force-overwrite gnucash_2.2.9-1_i386.deb
 
 
 
'''Run GnuCash'''
 
gnucash
 
 
 
'''Build and install Documentation'''
 
 
 
If you want the GnuCash documentation, you have to build and install that separately.  I couldn't get "checkinstall" to build a deb for the documentation, so I had to use make and make install as follows:
 
 
 
Comment: I got it to work by firering "make" first (after configure) and "checkinstall --default --install=no" afterwords.
 
 
 
wget <nowiki>http://www.gnucash.org/pub/gnucash/sources/stable/gnucash-docs-2.2.0.tar.gz</nowiki>
 
tar zxvf gnucash-docs-2.2.0.tar.gz
 
cd gnucash-docs-2.2.0
 
./configure
 
make
 
sudo make install
 
 
 
 
 
'''Warning (place this comment in a better place):''' In package ''guile-1.6-dev'', the script ''/usr/bin/guile-config'' is missing. This script is used by Gnucash's ''./configure'' in the building steps to determine the specific structure of ubuntu guile installation. Its absence causes ''./configure'' to break with a "Check your guile config" even if all is perfectly installed. To solve this problem, I have downloaded the debian counterpart package of ''guile-dev 1.6.8'', then extracted from it the seeked ''guile-config'' file and finally placed it in ''/usr/bin/''. Gnucash 2.2.1 building was then perfect. You can extract easily a file from a ''.deb'' using ''alien -t debfile.deb'' (you have to install alien) to obtain a ''.tgz'' file. Hope this helps others.
 
 
 
==== Dapper Flight 7 ====
 
 
 
'''get necessary packages'''
 
 
 
On a fresh install of Ubuntu/Dapper, do the following to be able to compile trunk gnucash:
 
 
 
sudo aptitude install libguile-dev libgwrapguile-dev guile-www
 
 
 
There are possibly other dependencies (that I already had installed), but this should get you started.
 
 
 
The below was ok for Flight 5
 
sudo aptitude install libgnomeui-dev libofx-dev libgsf-1-dev \
 
libgtkhtml3.8-dev guile-g-wrap libltdl3-dev g-wrap doxygen \
 
libgsf-gnome-1-dev automake1.9 texinfo build-essential intltool \
 
libtool subversion libfinance-quote-perl
 
 
 
For straight Dapper, I needed:
 
sudo aptitude install libglib2.0-dev intltool automake1.9 autoconf libtool libgconf2-dev swig slib libxml2
 
 
 
'''Create development tree'''
 
mkdir -p $HOME/development/gnucash
 
mkdir -p $HOME/unstable/gnucash
 
 
 
'''Check out gnucash trunk'''
 
cd $HOME/development/gnucash
 
svn checkout http://svn.gnucash.org/repo/gnucash/trunk gnucash
 
 
 
'''Compile gnucash'''
 
cd gnucash
 
./autogen.sh
 
 
 
./configure --prefix=$HOME/unstable/gnucash \
 
    --enable-debug --enable-doxygen \
 
    --enable-error-on-warning --enable-compile-warnings
 
 
 
make all install
 
 
 
'''Start newly compiled gnucash'''
 
cd $HOME/unstable/gnucash/bin
 
./gnucash
 
 
 
==== Ubuntu 5.10 (Breezy Badger) ====
 
 
 
Please see the [[BreezyBadgerInstallation]] page for more information on installing a beta snapshot of GnuCash on Breezy Badger.
 
 
 
=== 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 Core 5 ====
 
At least the following packages are required to build GnuCash from source on FC5:
 
libtool-ltdl-devel
 
guile-devel
 
g-wrap-devel
 
libgnomeprint22-devel
 
libgnomeprintui22-devel
 
gtkhtml3-devel
 
 
 
Suggested way to satify all requirements:
 
# yum install libtool-ltdl-devel guile-devel g-wrap-devel libgnomeprint22-devel \
 
  libgnomeprintui22-devel gtkhtml3-devel
 
 
 
Please note that while the configure script only checks for GtkHTML up to 3.8, recent versions of GtkHTML ship with "libgtkhtml-3.8.pc" so yes, you CAN use gtkhtml3-3.10 on FC5.
 
 
 
==== 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 subversion 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 SVN trunk:
 
 
 
mkdir -p ~/development
 
cd ~/development
 
svn co http://svn.gnucash.org/repo/gnucash/trunk 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.
 
 
 
=== in-tree approach ===
 
* checkout trunk from svn into folder $trunk
 
  e.g. svn co http://svn.gnucash.org/repo/gnucash/trunk gnucash-trunk
 
* download plugin-template.tgz to folder $downloads
 
  e.g. wget http://tellico.dyndns.org/gnucash/plugin-template.tgz
 
 
 
  cd $trunk/src
 
  mkdir plugins
 
  cd plugins
 
* extract all files/folders from plugin-template.tgz
 
  tar xzf $downloads/plugin-template.tgz
 
* include the new folder into the build process
 
  cd $trunk/src
 
  echo SUBDIRS+=plugins >> Makefile.am
 
  cd $trunk
 
* edit configure.in
 
insert the following line just before AC_OUTPUT
 
:AC_CONFIG_FILES(src/plugins/Makefile src/plugins/TEST1/Makefile src/plugins/TEST1/ui/Makefile src/plugins/TEST1/glade/Makefile)
 
* execute
 
./autogen.sh
 
./configure
 
make
 
make install
 
 
 
* to force GnuCash to load the plugin upon start
 
  echo '(gnc:module-load "gnucash/plugins/TEST1" 0)' >> ~/.gnucash/config.user
 
 
 
Now, a new command in menu Tools appears (which does nothing in this template).
 
 
 
==Microsoft Windows==
 
 
 
Compiling GnuCash in Windows is possible, but much more difficult than in linux. For details, see [[Windows|GnuCash on Microsoft Windows]].
 

Latest revision as of 15:37, 26 March 2024

Languages Deutsch עִברִית

This page deals with building GnuCash from the source code. It includes building the current stable release from source code (downloaded as tarballs) as well as the developers version of GnuCash from the Git repository. If you are searching for instructions for the version available from your distribution's software repositories, you should read 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.

Introduction

GnuCash can be built from sources on Linux distributions, Microsoft Windows and macOS. There are three major steps in building the GnuCash program. These are listed along with the tools which may used for each step:

  1. Configuration (cmake - autotools in earlier GnuCash versions)
  2. Compilation ( make or ninja)
  3. Installation (make or ninja)

Building GnuCash utilizes a set of tools which is available for all three of the major operating systems. These steps are described in detail for each operating system in the linked pages below, along with the installation of the build tools.

Build Tools

A general description of the tools used to configure and build GnuCash is given in Build tools.

A listing of dependencies is available at Dependencies.

The GnuCash build system has gone through some changes in the course of the 2.6 and 3 series. CMake has replaced the Autotools autogen and configure scripts for configuring the build. This has provided the ability to configure for alternative build systems and popular IDEs. Under the hood compilation and installation can now either be controlled using GNU Make or alternatively using the faster Ninja. Depending on the version of GnuCash you want to build you have the following options:

For the application generally
GnuCash 3 and more recent
These versions are configured using CMake. Autotools support has been removed. Either make or ninja may be used for the build.
GnuCash 2.6 and earlier
These versions are configured with Autotools and built with the GNU make utility. GnuCash from v2.6.13 allowed experimental use of cmake to configure and ninja to build.
For the Source API Documentation
This is built directly from the program sources. Depending on how the build system is configured you can use make doc or ninja doc. Note this requires Doxygen to be installed.
For the documentation
Since GnuCash 4.8
Only CMake with either Make or Ninja is supported
Upto GnuCash 4.7
The GnuCash Help and Tutorial and Concept Guide are configured with Autotools and built with Make.
CMake was introduced in 3.7.

Compiler

GnuCash ≥ 4.0 requires ISO-standard C++17 compatibility.

GnuCash 3.x required a C++ compiler that supports C11 and C++11. Gcc version ≥ 4.8 and Clang version ≥ 3.3 are known to work.

Source Platform

Building on Linux Distributions

Detailed instructions for building GnuCash on Linux distributions can be found on Building On Linux.

Building on macOS

macOS instructions can be found on MacOS/Quartz (This is the procedure used for building the binary packages) or GnuCash installation from source on macOS.

Building on Microsoft Windows

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