[Others] Compile and install GnuCash-4.8 from source
Tofloor
poster avatar
JasonZhang
deepin
2022-10-11 23:08
Author

GnuCash_logo.png

In Deepin's software repository, the version of Gnucash is still 3.8, which does not support remote databases. Looking at the documentation, I found that if you want to install the 4.x version, you have to compile it yourself. Here is my installation process.

Official documentation: https://wiki.gnucash.org/wiki/Install_Build_Tools

Repository: https://github.com/Gnucash/gnucash

Directory Description:

  • Source directory ~/project/gncash
  • Installation directory /opt/gnucash

1.Clone the code to ~/project/gnucash

cd ~/project && git clone git@github.com:Gnucash/gnucash.git

checkout 4.8

The latest version number as of the time of writing is 4.8. To install other versions, just check out other tags.

2.compile

2.1. Install the libraries required for compilation

sudo apt-get install build-essential make cmake ninja-build autoconf automake libtool m4

If it is ubuntu 20.04 LTS, you also need to execute

apt-get install libboost-program-options1.71-dev

2.2. Create a new gnucash folder under /opt

sudo cd /opt && mkdir gnucash && cd /opt/gnucash

2.3. Execute the cmake command

Build with Cmake and Make

sudo cmake -DCMADE_INSTALLPREFIX=/opt/gnucash ~/project/gnucash

Or build with Cmake and Ninja

sudo cmake -GNinja -DCMADE_INSTALLPREFIX=/opt/gnucash ~/project/gnucash

There may be various errors that make it impossible to continue, including but not limited to the following. Generally, some packages are missing and have not been installed. Just follow the error prompts to install.

No package 'libxslt' found

No package 'webkit2gtk-4.0' found

No package 'gwenhywfar' found

Neither guile 3.0, guile 2.2, nor guile 2.0 were found GnuCash can't run
without one of them. Ensure that one is installed and can be found with
pkg-config.

If it is really troublesome, ubuntu can directly install perl & build-essential, other distributions have not been tested, I don't know

sudo apt-get install perl build-essential

After entering the command, press Enter all the way, and continue to execute the build command in the previous step after the installation is complete.

If there is still an error, select the following package to install according to the error message

sudo apt-get install libxslt1-dev libwebkit2gtk-4.0-dev gettext swig guile-2.2-dev libgwengui-gtk3-dev libaqbanking-dev libofx-dev xsltproc libgtest-dev google-mock libmock-dev libsecret-1-dev libdbi1 libdbi-dev libboost-all-dev libdbd-mysql valgrind

After the build is successful, execute:

sudo make && sudo make install

or

sudo ninja && sudo ninja install

3.Operation

After the installation is complete, you can run gnucash

/opt/gnucash/bin/gnucash

Aliases can be created with the alias command:

alias gnucash="/opt/gnucash/bin/gnucash"

Or add environment variables:

sudo vim /home//.profile

Add any of the following lines

PATH = $PATH : $HOME /opt/gnucash/bin # Your home directory will be searched after system directories

or

PATH = $HOME /opt/gnucash/bin: $PATH # This will search your home directory before system directories

4.Create a desktop shortcut

Create a new GnuCash-4.8.desktop on the desktop and write the following content with a text editor

[Desktop Entry]

Categories=finance;

Comment[zh_CN]=

Comment=

Exec=/opt/gnucash/bin/gnucash

Icon=/opt/gnucash/share/gnucash/pixmaps/gnucash-icon.ico

MimeType=

Name[zh_CN]=GnuCash-4.8

Name=GnuCash-4.8

Path=

StartupNotify=true

Terminal=false

Type=Application

5.matters needing attention

Before each recompilation, it is best to clear the installation directory first, because after compiling and running, it always prompts that the library is missing, and finally clearing the installation directory and recompiling it will pass.

References:https://wiki.gnucash.org/wiki/Building_On_Linux

welcome to discuss with us:

Telegram: https://t.me/deepin

Discord:https://discord.gg/xjjkcp6H2P

Reply Favorite View the author
All Replies
a***a@gmail.com
deepin
2022-10-13 01:31
#1
The user is banned, and the content is hidden.
as******52@gmail.com
deepin
2022-12-16 03:08
#2
The user is banned, and the content is hidden.
am******42@gmail.com
deepin
2023-02-12 01:25
#3
The user is banned, and the content is hidden.