Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions contrib/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# The resulting image can be used to build librespot for linux x86_64, armhf and armel.
# $ docker run -v /tmp/librespot-build:/build librespot-cross
#
# To build librespot for armhf that also works on Raspberry Pi 1/Zero, run:
# $ docker run -v /tmp/librespot-build:/build librespot-cross /src/contrib/docker-build-pi-armv6hf.sh
#
# The compiled binaries will be located in /tmp/librespot-build
#
# If only one architecture is desired, cargo can be invoked directly with the appropriate options :
Expand Down
26 changes: 26 additions & 0 deletions contrib/docker-build-pi-armv6hf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -eux

#remove debian armhf installed tools/libs
apt-get purge -y crossbuild-essential-armhf
apt-get purge -y *:armhf

# get raspberry pi tools (cross compiler etc); use fixed revision for now, should be updated sometimes
mkdir /pi-tools
curl -L https://github.com/raspberrypi/tools/archive/648a6eeb1e3c2b40af4eb34d88941ee0edeb3e9a.tar.gz | tar xz --strip-components 1 -C /pi-tools
export PATH=/pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/:$PATH
# create wrapper around gcc to point to rpi sysroot
echo -e '#!/bin/bash' > /pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/gcc-sysroot
echo -e "arm-linux-gnueabihf-gcc --sysroot /pi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot \"\$@\"" >> /pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/gcc-sysroot
chmod +x /pi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/gcc-sysroot
# get alsa lib and headers
curl -OL http://mirrordirector.raspbian.org/raspbian/pool/main/a/alsa-lib/libasound2_1.0.25-4_armhf.deb
ar p libasound2_1.0.25-4_armhf.deb data.tar.gz | tar -xz -C /pi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot
curl -OL http://mirrordirector.raspbian.org/raspbian/pool/main/a/alsa-lib/libasound2-dev_1.0.25-4_armhf.deb
ar p libasound2-dev_1.0.25-4_armhf.deb data.tar.gz | tar -xz -C /pi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot/
# i don't why this is neccessary
ln -s ld-linux.so.3 /pi-tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/arm-bcm2708hardfp-linux-gnueabi/sysroot/lib/ld-linux-armhf.so.3
Copy link
Contributor

@michaelherger michaelherger Jun 16, 2017

Choose a reason for hiding this comment

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

What would the expected source folder be for this? My builds still fail. And when I check the binary with ldd it would still complain about a missing ld-linux.so.3:

$ ldd spotty
	libc.so.6 => /lib/libc.so.6 (0xb6981000)
	ld-linux.so.3 => not found
	libdl.so.2 => /lib/libdl.so.2 (0xb696e000)
	librt.so.1 => /lib/librt.so.1 (0xb6957000)
	libpthread.so.0 => /lib/libpthread.so.0 (0xb692e000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb6902000)
	libm.so.6 => /lib/libm.so.6 (0xb6884000)
	/lib/ld-linux-armhf.so.3 (0x7f61d000)

Copy link
Contributor

Choose a reason for hiding this comment

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

Just figured I tested on a piCore system rather than Raspbian. Your librespot binaries would fail there, too. Most likely this is due to an un-met pre-condition in piCore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Source folder is the same as target. Sorry that it doesn't work on piCore

# point cargo to use gcc wrapper as linker
echo -e '[target.arm-unknown-linux-gnueabihf]\nlinker = "gcc-sysroot"' > /.cargo/config

cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features alsa-backend