Open1
[記事未満] spotifyd を debian bullseye aarch64 でコンパイルしてみる

参考サイト
rust のインストールについて参考にしたページも追記したい。
環境について
Dockerイメージ Debian bullseye aarch64 にて。
$ sudo docker run --rm -it debian:bullseye-slim bash
# uname -a
Linux 0e0b49dfd4da 5.4.42-v8+ #1319 SMP PREEMPT Wed May 20 14:18:56 BST 2020 aarch64 GNU/Linux
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
rust インストール
apt でインストールするとバージョンが古い。
新しいバージョンを利用するため wget を利用してインストールする。
apt update && apt install --no-install-recommends wget ca-certificates
wget -qO - https://sh.rustup.rs | RUSTUP_HOME=/opt/rust CARGO_HOME=/opt/rust sh -s -- --no-modify-path -y
インストールできたことを確認
# export RUSTUP_HOME=/opt/rust
# export PATH=$PATH:/opt/rust/bin
# rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03)
ビルド
github より spotifyd のソースをクローン。
# apt install --no-install-recommends git
# cd /tmp
# git clone https://github.com/Spotifyd/spotifyd.git
依存パッケージをインストールしてビルド
# apt install --no-install-recommends build-essential pkg-config libasound2-dev
# cd spotifyd/
# cargo build --release
成果物を確認
# ls -l /tmp/spotifyd/target/release/spotifyd
# /tmp/spotifyd/target/release/spotifyd --version
spotifyd 0.3.5
# /tmp/spotifyd/target/release/spotifyd --help [2/1875]
spotifyd 0.3.5
Simon Persson <simon@flaskpost.org>, Sven Lechner <sven.lechner@rwth-aachen.de>
A Spotify daemon
USAGE:
spotifyd [FLAGS] [OPTIONS]
FLAGS:
--autoplay Start playing similar songs after your music has ended
--debug-credentials Whether the credentials should be debugged
-h, --help Prints help information
--no-audio-cache Disable the use of audio cache
--no-daemon If set, starts spotifyd without detaching
-V, --version Prints version information
--verbose Prints more verbose output
--volume-normalisation Enable to normalize the volume during playback
OPTIONS:
--audio-format <string>
The audio format of the streamed audio data [possible values: F32, S32, S24,
S24_3, S16]
-b, --backend <string> The audio backend to use [possible values: alsa]
-B, --bitrate <number>
The bitrate of the streamed audio data [possible values: 96, 160, 320]
-c, --cache-path <string> The cache path used to store credentials and music file artifacts
--config-path <string> The path to the config file to use
--control <string> The control device
--device <string> The audio device
-d, --device-name <string> The device name displayed in Spotify
--device-type <string>
The device type shown to clients [possible values: computer, tablet, smartphone,
speaker, tv, avr, stb, audiodongle]
--initial-volume <initial_volume> Initial volume between 0 and 100
--max-cache-size <max-cache-size> The maximal cache size in bytes
--mixer <string> The mixer to use
--normalisation-pregain <number>
A custom pregain applied before sending the audio to the output device
--on-song-change-hook <string>
A script that gets evaluated in the user's shell when the song changes [aliases: onevent]
-p, --password <string> The Spotify account password
-P, --password-cmd <string>
A command that can be used to retrieve the Spotify account password [aliases: password_cmd]
--pid <pid> Path to PID file
--proxy <string> The proxy used to connect to spotify's servers
-u, --username <string> The Spotify account user name
-U, --username-cmd <string>
A command that can be used to retrieve the Spotify account username [aliases: username_cmd]
-v, --volume-controller <volume-controller>
The volume controller to use [aliases: volume-control] [possible values: softvol,
alsa, alsa_linear, none]
--zeroconf-port <number> The port used for the Spotify Connect discovery
動かしてみる。
# /tmp/spotifyd/target/release/spotifyd --verbose --no-daemon
No config file specified. Running with default values
CliConfig { config_path: None, no_daemon: true, verbose: true, pid: None, shared_config: SharedConfigValues { username: None, username_cmd: None, password: None, password_cmd: None, use_keyring: false, use_mpris: None, dbus_type: None, on_song_change_hook: None, cache_path: None, no-audio-cache: false, backend: None, volume_controller: None, device: None, control: None, mixer: None, device_name: None, bitrate: None, audio_format: None, initial_volume: None, volume_normalisation: false, normalisation_pregain: None, zeroconf_port: None, proxy: None, device_type: None, autoplay: false, max_cache_size: None } }
Retrieving user shell through libc calls
Found user shell: Some("/bin/bash")
No username specified. Checking username_cmd
No username_cmd specified
No password specified. Checking password_cmd
No password_cmd specified
No proxy specified
Using software volume controller.
no usable credentials found, enabling discovery
Using device id '0247fe8fffa0f7f189d84841a648a99bf4e3f754'
Zeroconf server listening on 0.0.0.0:40271
found interface Interface { name: "eth0", addr: V4(Ifv4Addr { ip: 172.17.0.3, netmask: 255.255.0.0, broadcast: Some(172.17.255.255) }) }
sending packet to 224.0.0.251:5353
found interface Interface { name: "eth0", addr: V4(Ifv4Addr { ip: 172.17.0.3, netmask: 255.255.0.0, broadcast: Some(172.17.255.255) }) }
sending packet to [ff02::fb]:5353
error sending packet Os { code: 99, kind: AddrNotAvailable, message: "Cannot assign requested address" }
received packet from 172.17.0.3:5353
received packet from 172.17.0.3:5353 with no query
バイナリファイル(/tmp/spotifyd/target/release/spotifyd)のみを取り出して Raspberry Pi OS bullseye aarch64 配置しても動作した。
$ /tmp/spotifyd --no-daemon --verbose
No config file specified. Running with default values
CliConfig { config_path: None, no_daemon: true, verbose: true, pid: None, shared_config: SharedConfigValues { username: None, username_cmd: None, password: None, password_cmd: None, use_keyring: false, use_mpris: None, dbus_type: None, on_song_change_hook: None, cache_path: None, no-audio-cache: false, backend: None, volume_controller: None, device: None, control: None, mixer: None, device_name: None, bitrate: None, audio_format: None, initial_volume: None, volume_normalisation: false, normalisation_pregain: None, zeroconf_port: None, proxy: None, device_type: None, autoplay: false, max_cache_size: None } }
Found user shell: Some("/bin/bash")
No username specified. Checking username_cmd
No username_cmd specified
No password specified. Checking password_cmd
No password_cmd specified
No proxy specified
Using software volume controller.
no usable credentials found, enabling discovery
Using device id '018a4b977b33f640dd5c452d3f8a7858ae8c41d8'
Zeroconf server listening on 0.0.0.0:45859
(以下略)
スマホのSpotify アプリで確認すると「デバイスの選択」に下記が表示される
Spotifyd@ホスト名
Premiumへの登録が必要です
自分は Premium のアカウントを持っていないので確認はここまで。
心残り
--help
を実行すると下記の出力があった。
-b, --backend <string> The audio backend to use [possible values: alsa]
このままだとalsa しか選択できないと思われる。
Pulseaudio も使えるようにしたい。
ビルド前に pulseaudio の lib....-dev パッケージを追加してビルドすれば使えるようになるのかな???