-
Notifications
You must be signed in to change notification settings - Fork 638
Compiling
Rust 1.32.0 or later is required to build librespot, we recommend installing rust using rustup.
If you are building librespot on macOS, the homebrew provided rust may fail due to the way in which homebrew installs rust. In this case, uninstall the homebrew version of rust and use rustup, and librespot should then build.
A kernel version of 3.9 or higher is required.
Once you've cloned this repository you can build librespot using cargo
.
cargo build --release
The default for librespot is to build with Rodio for audio playback, and to use lewton as the decoder, which is a pure rust build on Windows and MacOS.
On Linux you'll need to follow the instructions for the ALSA backend.
However you can use cargo's feature flags to change these defaults e.g:
cargo build --release --no-default-features --features portaudio-backend
Here is a full list of available "features" and a short description.
Flag | Feature |
---|---|
rodio-backend |
Audio playback using WASAPI/CoreAudio/ALSA via Rodio. |
alsa-backend |
Audio playback using alsa. |
portaudio-backend |
Audio playback using PortAudio. |
pulseaudio-backend |
Audio playback using PulseAudio. |
jackaudio-backend |
Audio playback using JACK. |
sdl-backend |
Audio playback using SDL2. |
with-tremor |
Vorbis decoding using the fixed-point Tremor library. |
with-vorbis |
Vorbis decoding using libvorbis bindings. |
with-dns-sd |
LAN discovery using dns-sd instead of the default mDNS. |
Rodio is a high-level audio library built on top of CPAL. It is the default as it does not require any non-rust dependencies on windows or MacOS, and is able to use the native audio engines. On Linux the dependencies are the same for the ALSA backend.
Additionally requires pkg-config
and alsa
libs to be installed.
On debian / ubuntu, the following command will install these dependencies :
apt install libasound2-dev pkg-config
Or on fedora the alsa-lib-devel
package.
Building requires a C compiler, and of-course portaudio.
On debian / ubuntu, the following command will install these dependencies :
sudo apt install build-essential portaudio19-dev
On Fedora systems, the following command will install these dependencies :
sudo dnf install portaudio-devel make gcc
On macOS, using homebrew :
brew install portaudio
Finally enable the feature in cargo:
cargo build --release --features portaudio-backend