linux Building Cahute for Linux distributions

Warning

In order to install Cahute on Linux, it is recommended to use one of the methods described in Installing Cahute on Linux distributions. However, if Cahute is not available for your system, or if you wish to build it manually, this guide is for you.

The following building methods are available.

Note

Since you will not be using a packaged version of Cahute, the project won’t be automatically updated when updating the rest of the system, which means you will need to do it manually, especially if a security update is made.

You can subscribe to releases by creating a Gitlab.com account, and following the steps in Get notified when a release is created. You can check your notification settings at any time in Notifications.

Building Cahute natively for Linux

This guide will assume you have a POSIX or compatible shell, such as bash or zsh.

Downloading the Cahute source

In order to get the current released version of the Cahute source, you have the following options:

  • You can download the latest source package:

    curl -o cahute-0.6.tar.gz https://ftp.cahuteproject.org/releases/cahute-0.6.tar.gz
    tar xvaf cahute-0.6.tar.gz
  • You can clone the repository and checkout the tag corresponding to the release:

    git clone https://gitlab.com/cahuteproject/cahute.git cahute-0.6
    (cd cahute-0.6 && git checkout -f 0.6)

The project is present in the “cahute-0.6” directory.

Warning

If you are building the project in the context of the Creating a merge request guide, these commands need to be replaced by the following:

git clone <your-repo-url>

Where the repository’s URL can be obtained through the Code button on the Gitlab.com interface:

../_images/mr4.png

Gitlab.com’s repository interface with “Code” selected, presenting the options to clone the repository.

Installing the dependencies

Cahute depends on the following build-only dependencies:

It also depends on the following build and runtime dependencies:

In order to install the dependencies, it is recommended you use your native package manager. A few examples are the following:

  • On Debian and derivatives:

    sudo apt-get update
    sudo apt-get install cmake python3 python3-toml libusb-1.0-0-dev libsdl2-dev
    
  • On Archlinux and derivatives:

    sudo pacman -Sy cmake python python-toml libusb sdl2
    
  • On Voidlinux and derivatives:

    xbps-install cmake python3 python3-toml libusb-devel sdl2-devel
    

Building the project

In the parent directory to the source, you can now create the build directory aside it, and install from it, by running the following commands:

cmake -B build -S cahute-0.6 -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
cmake --build build

Note

While CMake uses -O3 by default for the Release configuration, this is considered an undesired behaviour by Cahute, hence Cahute overrides it with -O2 by default.

See CMAKE_BUILD_TYPE for more information.

Installing the project

If you want to install Cahute from the built version on your system directly, you can use the following command while in the build directory:

sudo cmake --install build --strip

If, however, you want to install the result into a given directory, you can use the following command:

DESTDIR=./dist cmake --install build --strip

Warning

For communicating with calculators over USB and serial, Cahute library and command-line utilities require access to such devices.

For serial devices, this is traditionally represented by being a member of the uucp group, defined as the group owner on /dev/ttyS* devices; you can check this by running ls -l /dev/ttyS*. However, by default, USB devices don’t have such rules.

CMake automatically installs the udev rules, which means you need to do the following:

  • Reload the udev daemon reload to apply the newly installed rules on the running system without a reboot, with this command as root:

    udevadm control --reload
    
  • Adding your user to the uucp group, then restarting your session:

    usermod -a -G uucp <your-username>