Building On Ubuntu

From GnuCash
Jump to: navigation, search


This page is about building GnuCash yourself under Ubuntu based distributions including Linux Mint… The general part is in Building On Linux. If something fails consult that page and pages linked there like Installing Dependencies.

Build Instructions

Kinetic Kudu 22.10

The following bash script will install the required dependencies to build and install gnucash on Ubuntu 22.10.

Important!
You must open "Software and Updates" and make sure that "Source code" is ticked or this script will fail.

This script will checkout and build Gnucash version 4.13; change this to maint if you want the maintenance release, or to a different version number if you want a different version. This script will run through the whole process of building and installing and won't ask for confirmation.

## Ubuntu 22.10
## In "Software and Updates":
## Tick "Source code"
## Tick "Community-maintained free and open-source software (Universe)"

## Change this if you want to build it somewhere else.
SOURCEDIR="$HOME/Documents/gnucash/source"
BUILDDIR="$HOME/Documents/gnucash/build"

## Change this if you want to install it somewhere else
INSTALLDIR=/opt/gnucash

sudo apt -y update
sudo apt -y upgrade
sudo apt -y build-dep gnucash
sudo apt -y install git

mkdir -p $SOURCEDIR
mkdir -p $BUILDDIR

## Clone gnucash source from git
git clone https://github.com/Gnucash/gnucash.git $SOURCEDIR

## Checkout version 4.13
cd $SOURCEDIR
git checkout -B 4.13 4.13

cd $BUILDDIR
cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR $SOURCEDIR

make
sudo make install

You can create a desktop icon for launching gnucash by saving the following to a file called gnucash-4.13.desktop (or gnucash-maint.desktop, or whatever). Once you have created this file, right-click on it and choose "Allow Launching".

[Desktop Entry]
Type=Application
Terminal=false
Exec=/opt/gnucash/bin/gnucash
Name=GnuCash 4.13
Comment=Manage home and small business accounts
Icon=/opt/gnucash/share/gnucash/pixmaps/gnucash-icon.ico

Keeping up with maint or the next release

Once you have installed the dependencies, as shown in the script above, and cloned the source from git, you can keep up with the maintenance release or the next release by using a simplified version of the script:

## Ubuntu 22.10

## Make sure these locations are the same as the ones you used above.
SOURCEDIR="$HOME/Documents/gnucash/source"
BUILDDIR="$HOME/Documents/gnucash/build"

## Change this if you want to install it somewhere else
INSTALLDIR=/opt/gnucash

# Make sure ubuntu is up-to-date
sudo apt -y update
sudo apt -y upgrade

## Get the latest source code changes from git
cd $SOURCEDIR
git pull

## Checkout maint (or whatever version you want)
git checkout -B maint maint

cd $BUILDDIR
cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR $SOURCEDIR

make
sudo make install


Jammy Jellyfish 22.04

The following bash script will install the required dependencies to build and install gnucash on Ubuntu 22.04.

Important!
You must open "Software and Updates" and make sure that "Source code" is ticked or this script will fail.

This script will checkout and build Gnucash version 4.9; change this to maint if you want the maintenance release, or to a different version number if you want a different version. This script will run through the whole process of building and installing and won't ask for confirmation.

## Ubuntu 22.04
## In "Software and Updates":
## Tick "Source code"
## Tick "Community-maintained free and open-source software (Universe)"

## Change this if you want to build it somewhere else.
SOURCEDIR="$HOME/Documents/gnucash/source"
BUILDDIR="$HOME/Documents/gnucash/build"

## Change this if you want to install it somewhere else
INSTALLDIR=/opt/gnucash

sudo apt -y update
sudo apt -y upgrade
sudo apt -y build-dep gnucash
sudo apt -y install git

mkdir -p $SOURCEDIR
mkdir -p $BUILDDIR

## Clone gnucash source from git
git clone https://github.com/Gnucash/gnucash.git $SOURCEDIR

## Checkout version 4.9
cd $SOURCEDIR
git checkout -B 4.9 4.9

cd $BUILDDIR
cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR $SOURCEDIR

make
sudo make install

You can create a desktop icon for launching gnucash by saving the following to a file called gnucash-4.9.desktop (or gnucash-maint.desktop, or whatever). Once you have created this file, right-click on it and choose "Allow Launching".

[Desktop Entry]
Type=Application
Terminal=false
Exec=/opt/gnucash/bin/gnucash
Name=GnuCash 4.9
Comment=Manage home and small business accounts
Icon=/opt/gnucash/share/gnucash/pixmaps/gnucash-icon.ico

Keeping up with maint or the next release

Once you have installed the dependencies, as shown in the script above, and cloned the source from git, you can keep up with the maintenance release or the next release by using a simplified version of the script:

## Ubuntu 22.04

## Make sure these locations are the same as the ones you used above.
SOURCEDIR="$HOME/Documents/gnucash/source"
BUILDDIR="$HOME/Documents/gnucash/build"

## Change this if you want to install it somewhere else
INSTALLDIR=/opt/gnucash

# Make sure ubuntu is up-to-date
sudo apt -y update
sudo apt -y upgrade

## Get the latest source code changes from git
cd $SOURCEDIR
git pull

## Checkout maint (or whatever version you want)
git checkout -B maint maint

cd $BUILDDIR
cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR $SOURCEDIR

make
sudo make install


Focal Fossa 20.04 LTS

(Also works for Linux Mint 20.2)

The version of gnucash in this Ubuntu release's universe repository is 3.8, so the "apt-get build-dep gnucash" pulls in build dependencies for this gnucash 3.8 release. If you are installing gnucash 4.2, you need to install an extra build dependency otherwise you'll get this error during the build:
Could not find a package configuration file provided by "boost_program_options" (requested version 1.71.0) with any of the following names:
    boost_program_optionsConfig.cmake
    boost_program_options-config.cmake
To provide this dependency:
apt-get install libboost-program-options1.71-dev

The following bash script will install the required dependencies to build and install gnucash on Ubuntu 20.04. NOTE: you must open "Software and Updates" and make sure that "Source code" is ticked or this script will fail. This script will checkout and build version 4.9; change this to maint if you want the maintenance release, or to a different version number if you want a different version. This script will run through the whole process of building and installing and won't ask for confirmation.

## Ubuntu 20.04
## In "Software and Updates":
## Tick "Source code"
## Tick "Community-maintained free and open-source software (Universe)"

## Change this if you want to build it somewhere else.
SOURCEDIR="$HOME/Documents/gnucash/source"
BUILDDIR="$HOME/Documents/gnucash/build"

## Change this if you want to install it somewhere else.
INSTALLDIR=/opt/gnucash

sudo apt -y update
sudo apt -y upgrade
sudo apt -y install git
sudo apt -y build-dep gnucash


## To build series 4 of gnucash on Ubuntu 20.04
sudo apt -y install libboost-program-options1.71-dev

mkdir -p $SOURCEDIR
mkdir -p $BUILDDIR

## Clone gnucash source from git
git clone https://github.com/Gnucash/gnucash.git $SOURCEDIR

## Checkout version 4.9
cd $SOURCEDIR
git checkout -B 4.9 4.9

cd $BUILDDIR
cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR $SOURCEDIR

make
sudo make install

You can create a desktop icon for launching gnucash by saving the following to a file called gnucash-4.9.desktop (or gnucash-maint.desktop, or whatever). Once you have created this file, right-click on it and choose "Allow Launching".

[Desktop Entry]
Type=Application
Terminal=false
Exec=/opt/gnucash/bin/gnucash
Name=GnuCash 4.9
Comment=Manage home and small business accounts
Icon=/opt/gnucash/share/gnucash/pixmaps/gnucash-icon.ico

Keeping up with maint or the next release

Once you have installed the dependencies, as shown in the script above, and cloned the source from git, you can keep up with the maintenance release or the next release by using a simplified version of the script:

## Ubuntu 20.04

## Make sure these locations are the same as the ones you used above.
SOURCEDIR="$HOME/Documents/gnucash/source"
BUILDDIR="$HOME/Documents/gnucash/build"

## Change this if you want to install it somewhere else
INSTALLDIR=/opt/gnucash

# Make sure ubuntu is up-to-date
sudo apt -y update
sudo apt -y upgrade

## Get the latest source code changes from git
cd $SOURCEDIR
git pull

## Checkout maint (or whatever version you want)
git checkout -B maint maint

cd $BUILDDIR
cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR $SOURCEDIR

make
sudo make install

Known Issues

Bionic Beaver 18.04

In Oct 2018 Issues with building GnuCash v3.2/3.3 on Ubuntu 18.04 associated with a bug in the libwebkit2gtk-4.0-37 version. At the time the fix was downgrading the version of libwebkit to an earlier version as follows:
sudo apt install libwebkit2gtk-4.0-dev=2.20.1-1 libwebkit2gtk-4.0-37=2.20.1-1 gir1.2-webkit2-4.0=2.20.1-1 libjavascriptcoregtk-4.0-dev=2.20.1-1 gir1.2-javascriptcoregtk-4.0=2.20.1-1 libjavascriptcoregtk-4.0-18=2.20.1-1

In November 2018 a Stable Release Update updated the libwebkit2gtk-4.0-dev package so the workaround above should no longer be necessary (if your security updates have been applied). As of September 2019, the package has been updated again, so a fully updated Bionic should supply libwebkit2gtk-4.0-dev version 2.24.4-0ubuntu0.18.04.1