Difference between revisions of "Building"

From GnuCash
Jump to: navigation, search
m (Added hook for Building Gutsy)
m (>= -> ≥)
 
(201 intermediate revisions by 33 users not shown)
Line 1: Line 1:
== General Instructions ==
+
{| class="wikitable" style="margin: auto;"
For the very latest source code, [[Subversion|get the sources from Subversion]]; alternatively, use the latest release source file of type <tt>gnucash-<version>.tar.gz</tt>. Examine 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.
+
! 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]].
  
Here are the basic steps one might end up taking:
+
This page doesn't provide specific instructions for optional third-party modules&mdash;like ''AqBanking'' or Perl ''Finance::Quote''&mdash;but does list the dependencies required and links to the configuration switches used with CMake to include them during compilation.
  
1. Change to gnucash directory
+
== Introduction ==
  cd gnucash
+
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:
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
 
4. Run configure with the appropriate options; some example options might look as follows
 
  ./configure --prefix=/opt/gnucash \
 
    --enable-debug --enable-doxygen \
 
    --enable-error-on-warning --enable-compile-warnings \
 
    [--enable-ofx [...]]
 
5. Compile and install
 
  make
 
  make install
 
6. Run
 
  /opt/gnucash/bin/gnucash
 
  
== Distro-specific Information ==
+
# Configuration (cmake - autotools in earlier GnuCash versions)
See the [http://svn.gnucash.org/trac/file/gnucash/trunk/README.dependencies README.dependencies] file for library dependency notes.
+
# Compilation ( make or ninja)
Also check out [[Dependencies|the dependencies page]].
+
# Installation (make or ninja)
  
=== Debian ===
+
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.
  
If you are lucky running
+
== Build Tools ==
  apt-get build-deps gnucash
+
A general description of the tools used to configure and build GnuCash is given in [[Build_Tools |Build tools]].
will install everything you need to build gnucash.
 
  
On Debian, the packages you'll probably need are (among many others):
+
A listing of dependencies is available at [[Dependencies]].
  
guile-1.6-dev
+
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:
swig
+
;For the application generally:
libgnome2-dev
+
:;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.
libgnomeui-dev
+
:;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.
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:
+
;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.
  
automake
+
;For the documentation:
intltool
+
:;Since GnuCash 4.8: Only [[Build_Tools#CMake|CMake]] with either [[Build_Tools#Make|Make]] or [[Build_Tools#Ninja|Ninja]] is supported
libtool
+
:;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]].
guile-1.6-dev
+
::[[Build_Tools#CMake|CMake]] was introduced in 3.7.
  
For the 2.0-branch of GnuCash you need additionally:
+
== Compiler ==
libgwrapguile-dev OR
+
'''GnuCash &ge; 4.0''' requires ISO-standard '''C++17''' compatibility.
guile-g-wrap
 
  
If you see the error "<unnamed port>: no code for module (g-wrap gw standard)" at runtime, see
+
'''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.
[[FAQ#Q:_Running_2.0.x_on_Debian.2FUbuntu_crashes_with_.22no_code_for_module_.28g-wrap_gw_standard.29.22.__What_does_this_mean.3F|this particular FAQ]].
 
  
=== Ubuntu ===
+
== Source Platform ==
 +
=== Building on Linux Distributions ===
 +
Detailed instructions for building GnuCash on Linux distributions can be found on [[Building_On_Linux | Building On Linux]].
  
If you are on an older version of ubuntu (or debian for that matter) such as dapper with long-term support and need certain packages that are not available from the [http://packages.ubuntu.com/dapper-backports/ dapper-backports] do not fret. You can easily compile them yourself (essentially backporting them).  Make sure you have a line of the form
+
=== 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]].
  
deb-src http://archive.ubuntu.com/ubuntu edgy main restricted universe
+
=== Building on Microsoft Windows ===
 
+
Compiling GnuCash on Windows is possible, but much more difficult than on Linux.  
in your /etc/apt/sources.list.  You want the version (edgy 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.
+
For details, see [[Building on Windows|building GnuCash on Microsoft Windows]].
 
 
cd /usr/src
 
sudo apt-get build-dep ''$packageyouwant''
 
apt-get --compile source ''$packageyouwant''
 
dpkg -i ''$packageyouwant''.deb
 
 
 
Easy as 1-2-3!
 
 
 
==== Breezy Badger ====
 
 
 
Please see the [[BreezyBadgerInstallation]] page for more information on installing a beta snapshot of GnuCash on Breezy Badger.
 
 
 
 
 
==== Dapper Flight 7 ====
 
 
 
'''get necessary packages'''
 
 
 
On a fresh install of Ubuntu/Dapper, do the following to be able to compile trunk gnucash:
 
 
 
sudo apt-get 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 apt-get 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 apt-get 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
 
 
 
 
 
==== Feisty ====
 
'''Get Dependencies'''
 
sudo apt-get install build-essential checkinstall guile-1.6-dev guile-1.6-slib libgoffice-0-dev libgtkhtml3.14-dev texinfo gettext intltool libtool swig
 
 
 
'''Get GnuCash 2.2 Source'''
 
wget <nowiki>http://www.gnucash.org/pub/gnucash/sources/stable/gnucash-2.2.1.tar.gz</nowiki>
 
tar zxvf gnucash-2.2.1.tar.gz
 
cd gnucash-2.2.1
 
 
 
'''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.1-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.1-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.1-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 apt-get alien) to obtain a ''.tgz'' file. Hope this helps others.
 
 
 
==== Gutsy ====
 
 
 
See [[BuildGutsy]]
 
 
 
=== Gentoo ===
 
 
 
Gentoo instructions can be found on [[Gentoo|Gnucash-svn installation on Gentoo]].
 
 
 
=== Mac OS X ===
 
 
 
Mac OS X instructions can be found on [[MacOSXInstallation| gnucash installation from source on Mac OS X]].
 
 
 
=== 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.
 

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.