Skip to content

Commit

Permalink
Drop ARMv6 support
Browse files Browse the repository at this point in the history
It is with a heavy heart that I do this but we are reaching the limits of the Pi 1 and Zero v1.x CPU (they aren't powerful enough for volume normalization) and librespot will soon be merging a rewrite that is incompatible with ARMv6 (it will not compile).

The upside to this is that since we are now purely relying on vanilla Debian Stable for our libs (except librespot ofc) that should mean wider compatability with other Debian based armhf distros and it opens up the possibility of including the pulseaudio backend in the builds.
  • Loading branch information
JasonLG1979 committed Feb 5, 2022
1 parent d9d110c commit 345f15c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 37 deletions.
38 changes: 13 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM debian:stable

ENV INSIDE_DOCKER_CONTAINER 1

RUN dpkg --add-architecture arm64
RUN dpkg --add-architecture arm64 \
&& dpkg --add-architecture armhf

RUN apt-get update \
&& apt-get -y upgrade \
Expand All @@ -11,6 +12,8 @@ RUN apt-get update \
libasound2-dev \
crossbuild-essential-arm64 \
libasound2-dev:arm64 \
crossbuild-essential-armhf \
libasound2-dev:armhf \
curl \
git \
pandoc \
Expand All @@ -24,35 +27,20 @@ RUN pip3 install \
jinja2-cli \
unidecode

RUN mkdir /toolchain
WORKDIR /toolchain

# Check out Raspbian cross-compiler (this will work on *ALL* Raspberry Pi versions)
RUN git clone --depth 1 git://github.com/raspberrypi/tools.git rpi-tools \
&& rm -rf rpi-tools/.git
ENV PATH "/toolchain/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/:${PATH}"

# Create wrapper around gcc to point to rpi sysroot
# Thanks @ https://github.com/herrernst/librespot/blob/build-rpi/.travis.yml
RUN echo '#!/bin/sh\narm-linux-gnueabihf-gcc --sysroot /toolchain/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot "$@"' \
> rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/gcc-wrapper \
&& chmod +x rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/gcc-wrapper \
&& ln -s ld-linux.so.3 rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot/lib/ld-linux-armhf.so.3

# Install alsa-utils which is needed for compilation
ENV PKG_CONFIG_ALLOW_CROSS 1
ENV PKG_CONFIG_PATH "/toolchain/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot/lib/pkgconfig"
RUN curl -O https://www.alsa-project.org/files/pub/lib/alsa-lib-1.2.6.tar.bz2 \
&& tar xvjf alsa-lib-1.2.6.tar.bz2 && cd alsa-lib-1.2.6 \
&& CC=arm-linux-gnueabihf-gcc ./configure --host=arm-linux-gnueabihf --disable-python \
--prefix=/toolchain/rpi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot \
&& make -j $(nproc --all) && make install \
&& cd .. && rm -rf alsa-lib-1.2.6.tar.bz2 alsa-lib-1.2.6
ENV PKG_CONFIG_PATH "/usr/lib/arm-linux-gnueabihf/pkgconfig"

RUN mkdir /build

# Install most recent version of rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH "/root/.cargo/bin/:$PATH"
ENV CARGO_TARGET_DIR "/build"
ENV CARGO_HOME "/build/cache"

RUN rustup target add aarch64-unknown-linux-gnu \
&& rustup target add armv7-unknown-linux-gnueabihf

RUN mkdir /.cargo

RUN echo '[target.aarch64-unknown-linux-gnu]\nlinker = "aarch64-linux-gnu-gcc"' > /.cargo/config \
&& echo '[target.armv7-unknown-linux-gnueabihf]\nlinker = "arm-linux-gnueabihf-gcc"' >> /.cargo/config
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ raspotify_*.deb:
--env PERMFIX_UID="$$(id -u)" \
--env PERMFIX_GID="$$(id -g)" \
--env RASPOTIFY_AUTHOR="$(RASPOTIFY_AUTHOR)" \
--env BUILD_TARGET="arm-unknown-linux-gnueabihf" \
--env BUILD_LINKER="gcc-wrapper" \
--env BUILD_TARGET="armv7-unknown-linux-gnueabihf" \
--env ARCHITECTURE="armhf" \
raspotify /mnt/raspotify/build.sh
docker run \
Expand All @@ -21,7 +20,6 @@ raspotify_*.deb:
--env PERMFIX_GID="$$(id -g)" \
--env RASPOTIFY_AUTHOR="$(RASPOTIFY_AUTHOR)" \
--env BUILD_TARGET="aarch64-unknown-linux-gnu" \
--env BUILD_LINKER="aarch64-linux-gnu-gcc" \
--env ARCHITECTURE="arm64" \
raspotify /mnt/raspotify/build.sh
docker run \
Expand All @@ -31,7 +29,6 @@ raspotify_*.deb:
--env PERMFIX_GID="$$(id -g)" \
--env RASPOTIFY_AUTHOR="$(RASPOTIFY_AUTHOR)" \
--env BUILD_TARGET="x86_64-unknown-linux-gnu" \
--env BUILD_LINKER="x86_64-linux-gnu-gcc" \
--env ARCHITECTURE="amd64" \
raspotify /mnt/raspotify/build.sh

Expand Down
5 changes: 0 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ echo 'Building in docker container'
set -e
cd /mnt/raspotify

# Install the gcc wrapper in container into cargo
mkdir -p /.cargo
echo "[target.${BUILD_TARGET}]\nlinker = \"${BUILD_LINKER}\"" > /.cargo/config
rustup target add $BUILD_TARGET

# Get the git rev of raspotify for .deb versioning
RASPOTIFY_GIT_VER="$(git describe --tags --always --dirty 2>/dev/null || echo unknown)"

Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ SOURCE_REPO="deb [signed-by=/usr/share/keyrings/raspotify_key.asc] https://dtcoo
# Install script for Raspotify. Adds the Debian repo and installs.
set -e

if ! which apt-get apt-key > /dev/null || uname -a | fgrep -ivq -e arm -e aarch64 -e x86_64; then
echo "The Raspotify installer only runs on armhf, arm64, and amd64 Debian based systems."
if ! which apt-get apt-key > /dev/null || uname -a | fgrep -ivq -e armv7 -e aarch64 -e x86_64; then
echo "The Raspotify installer only runs on armhf (ARMv7), arm64, and amd64 Debian based systems."
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion raspotify/lib/systemd/system/raspotify.service
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ RemoveIPC=true

CapabilityBoundingSet=

#SystemCallArchitectures=native
SystemCallArchitectures=native
SystemCallFilter=@system-service
SystemCallFilter=~@privileged @resources
SystemCallErrorNumber=EPERM
Expand Down

2 comments on commit 345f15c

@tsgsh
Copy link

@tsgsh tsgsh commented on 345f15c Feb 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JasonLG1979 v0.3.1 of librespot bundled with raspotify v0.3.11.1 appears not to run on armhf. Not a problem for me because I'd compiled v0.3.0 for armhf a few months back but for those raspotify users who have armhf hardware and who can't upgrade because there is no supply of anything other than RPi 400s at the moment, it would be good to fix this, This was on an RPi Zero W built with 2021-10-30-raspios-bullseye-armhf-lite.img that I did an apt update and apt-upgrade on after I saw this commit.

pi@shaun:~ $ dpkg -S /usr/bin/librespot
raspotify: /usr/bin/librespot
pi@shaun:~ $ apt -a list raspotify 
Listing... Done
raspotify/unknown,now 0.31.11.1~librespot.v0.3.1-60-g616809b armhf [installed]

pi@shaun:~ $ /usr/bin/librespot -v
Illegal instruction
pi@shaun:~ $ /usr/local/bin/librespot -v
[2022-02-16T00:21:38Z INFO  librespot] librespot 0.3.0 UNKNOWN (Built on 2021-10-20, Build ID: tF82qnax)
[2022-02-16T00:21:38Z DEBUG librespot_playback::mixer::mappings] Volume control is now Log(60.0)
[2022-02-16T00:21:38Z DEBUG librespot_discovery::server] Zeroconf server listening on 0.0.0.0:33039
[2022-02-16T00:21:38Z WARN  libmdns] Failed to register IPv6 receiver: Os { code: 19, kind: Uncategorized, message: "No such device" }
^C[2022-02-16T00:21:40Z INFO  librespot] Gracefully shutting down
pi@shaun:~ $ 

@JasonLG1979
Copy link
Collaborator Author

@JasonLG1979 JasonLG1979 commented on 345f15c Feb 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the place to file a bug report. But...

@JasonLG1979 v0.3.1 of librespot bundled with raspotify v0.3.11.1 appears not to run on armhf.

It runs just fine on armhf. Stock Debian armhf packages will not run on Pi Zero v1.x's or Pi 1's because they are ARMv6. Raspberry Pi OS rebuilds it's packages and patches in ARMv6 support. In vanilla Debian if you want ARMv6 support you have to use the armel version. See here

for those raspotify users who have armhf hardware and who can't upgrade because there is no supply of anything other than RPi 400s at the moment, it would be good to fix this,

It's not an issue that can be fixed. ARMv6 is a dead platform. The soon to be merged (in a couple weeks) rewrite of librespot has dependencies that are not compatible with ARMv6. An ARMv6 compatible binary can not be built from that branch.

This was on an RPi Zero W built with 2021-10-30-raspios-bullseye-armhf-lite.img that I did an apt update and apt-upgrade on after I saw this commit.

Yes. That is to be expected. ARMv6 support has been dropped. Raspotify will no longer work on Pi Zero v1.x's or Pi 1's. The README clearly states as much.

There is also a link in the README to the last ARMv6 compatible build.

It's in wiki now.

Please sign in to comment.