💾 Archived View for yaky.dev › 2022-03-17-spot-on-rpi captured on 2023-06-14 at 14:11:32. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-05-24)

➡️ Next capture (2023-09-08)

-=-=-=-=-=-=-

Yaky's

home

notes

apps

Building Spot from source on Raspberry Pi

Spot is a Spotify client for desktop and mobile Linux, developed using Rust, GTK4 and libadwaita.

Spot on GitHub

I wanted to install and use it on a Raspberry Pi as a part of a larger project. Although a flatpak is available, it seems slower than natively built.

TLDR

If you just want the binary:

Spot - ARM64 binary (built on Raspberry Pi 3B)

Device and OS

I used Raspberry Pi 3B running 64-bit Raspbian with desktop. 64-bit Raspbian Lite should work too.

Note: When I tried to build Spot on a 32-bit OS, it still compiled, but crashed on launch with a widget-related error.

Raspberry Pi operating systems

Instead of building Spot yourself, you can get a flatpak, but it appeared to work slower for me. Flatpak is only available for 64-bit OSes on ARM devices, too.

Spot on Flatpak

Setup and prerequisites

Expand swap

Compiling GTK4 for Rust and building the final Spot binary requires about 2.5 GB of memory. I had to expand the swap size to at least 2 GB.

Disable swap:

# dphys-swapfile swapoff

Edit the swap file settings:

# nano /etc/dphys-swapfile

In the file, set

CONF_SWAPSIZE=2048

Save and close.

Set up the new swap:

# dphys-swapfile setup

(this will take a few minutes)

Turn swap back on:

# dphys-swapfile swapon

Reboot for a good measure.

After rebooting, check for available swap space:

$ free -h

Add the testing repo

Spot is built with GTK4 and libadwaita, both of which are only available in Debian's testing repo.

WARNING: Update before you add the testing repo. I know I am violating one of the Debian fundamentals and making a FrankenDebian, but it will be a while until those packages are available on bullseye.

Don't Break Debian

Update your current install if you haven't done so:

# apt update && apt upgrade
# reboot

Append the bookworm repo to the sources

# echo "deb http://deb.debian.org/debian bookworm main contrib non-free" >> /etc/apt/sources.list
# apt update

Install Rust

WARNING: Running scripts directly from the web is a very dumb idea, but in this case, I trust Rust developers

$ curl --proto '=https' -sSf https://sh.rustup.rs | sh

Install dependencies

Note: ninja-build is not the same package as ninja, and can cause conflicts

# apt install libgtk-4-dev libadwaita-1-dev meson ninja-build libssl-dev libasound2-dev libpulse-dev libtls-dev appstream-util

Build process also requires an updated version of CC:

# apt install gcc --upgrade

Build Spot

Spot on GitHub

# apt install git
$ git clone https://github.com/xou816/spot
$ cd spot
$ meson setup target -Dbuildtype=release -Doffline=false --prefix="$HOME/.local"
$ ninja install -C target -j1 -l1

And give it a few hours... depending on your device, amount of RAM and SD card speed.

Keyring

Spot uses GNOME keyring to store username and password. Simplest way to work with the keyring is to install Seahorse (aka Passwords and Keys)

# apt install seahorse

Open Seahorse, create a new password keyring, set it as default, and unlock it. Sign into Spot, which will create an entry in the default keyring. As long as the keyring is unlocked, Spot can use the provided username, password and token.

Hints and Troubleshooting

You can monitor current CPU and memory load using `top` or `htop` commands in a separate terminal.

If your build fails with SIGKILL, most likely, Raspberry Pi is out of memory.

CC-BY yaky.dev