Shairport-sync: Compile on raspbian with --with-libdaemon

Created on 28 Jan 2021  路  14Comments  路  Source: mikebrady/shairport-sync

Hi,
I'm trying to compile Shairport-sync with libdaemon enabled on raspbian. This is because I want dbus support and the standard package does not have it included.

I am specifying the following

./configure --with-libdaemon --with-pipe --with-dbus-interface --with-avahi --with-ssl=openssl --with-metadata

this configures and compiles just fine but when I run with the -d option, I get the following error message.

shairport-sync was built without libdaemon, so does not support daemonisation using the -d, --daemon, -j or --justDaemoniseNoPIDFile options

I cannot work out why this is not working. I have tried the --with-systemv and --with-systemd. Neither make any difference.

As a little background ...

I am not running make install because I already have a working configuration. I just want to replace the existing binary with the new binary with dbus included. The distributed binary does have the -d flag and seems to use it in the system script.

I have already set up the dbus configuration based upon the dbus configuration file in the docker release. I only need pipe output which is why I am not including support for other outputs.

Unfortunately the docker version doesn't work for me despite including dbus because I am already running Avahi on the host and this created a lot of problems.

Any help will be greatly appreciated.

Many thanks

bug fixed in development branch

All 14 comments

Thanks for the post. If you have stopped after the make step, then the new Shairport Sync binary will not be placed in a directory where it will be automatically found for execution. Thus, if you enter:

$ shairport-sync

it will still execute the (older) installed Shairport Sync. To run the new Shairport Sync, while still in the build directory, enter:

$ ./shairport-sync

Perhaps you could post the output from both of these commands?

But, separately, you don't actually need libdaemon to get the dbus interface (at least, not on any reasonably up-to-date version of Raspberry Pi OS). Instead, all you need is to add the --with-dbus-interface flag.

@mikebrady thank you for the response.

Yes I was running the local version using ./shairport-sync. Here are the outputs you requested.

./shairport-sync -V
3.3.8rc3-OpenSSL-Avahi-pipe-metadata-dbus-sysconfdir:/usr/local/etc
./shairport-sync --help
Usage: ./shairport-sync [options...]
  or:  ./shairport-sync [options...] -- [audio output-specific options]

Options:
    -h, --help              show this help.
    -V, --version           show version information.
    -c, --configfile=FILE   read configuration settings from FILE. Default is /etc/shairport-sync.conf.

with comparison to the distro binary

shairport-sync -V
3.2.2-OpenSSL-Avahi-ALSA-pa-dummy-stdout-pipe-soxr-convolution-metadata-sysconfdir:/etc
shairport-sync --help
Usage: shairport-sync [options...]
  or:  shairport-sync [options...] -- [audio output-specific options]

Options:
    -h, --help              show this help.
    -d, --daemon            daemonise.
    -j, --justDaemoniseNoPIDFile            daemonise without a PID file.
    -V, --version           show version information.
    -k, --kill              kill the existing shairport daemon.
    -D, --disconnectFromOutput  disconnect immediately from the output device.
    -R, --reconnectToOutput  reconnect to the output device.
    -c, --configfile=FILE   read configuration settings from FILE. Default is /etc/shairport-sync.conf.

This is the existing systemd conf file in /lib/systemd/system/ which seems to use the --daemon flag

more shairport-sync.service
[Unit]
Description=ShairportSync AirTunes receiver
Documentation=man:shairport-sync(7)
Documentation=file:///usr/share/doc/shairport-sync/README.md.gz
Documentation=https://github.com/mikebrady/shairport-sync
After=sound.target
Requires=avahi-daemon.service
After=avahi-daemon.service

[Service]
Type=forking
Restart=on-failure
EnvironmentFile=-/etc/default/shairport-sync
ExecStart=/usr/bin/shairport-sync --daemon $DAEMON_ARGS
User=shairport-sync
Group=shairport-sync
PIDFile=/run/shairport-sync/shairport-sync.pid

[Install]
WantedBy=multi-user.target

and this is /etc/os-release

PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Thanks

A little more information about the package installed

dpkg -s shairport-sync
Package: shairport-sync
Status: install ok installed
Priority: optional
Section: sound
Installed-Size: 306
Maintainer: Chris Boot <[email protected]>
Architecture: armhf
Source: shairport-sync (3.2.2-1)
Version: 3.2.2-1+b2
Depends: adduser, avahi-daemon, libasound2 (>= 1.0.17), libavahi-client3 (>= 0.6.16), libavahi-common3 (>= 0.6.16), libc6 (>= 2.15), libconfig9, libdaemon0 (>= 0.14), libgcc1 (>= 1:3.5), libpopt0 (>= 1.14), libpulse0 (>= 0.99.1), libsndfile1 (>= 1.0.20), libsoxr0 (>= 0.1.0), libssl1.1 (>= 1.1.0), libstdc++6 (>= 4.9)
Conffiles:
 /etc/default/shairport-sync 4c7fa8006ca0717aa1dda3d1480cd5e2
 /etc/init.d/shairport-sync ede9f660d8459acc404236e2a3aba2b5
 /etc/shairport-sync.conf bf5a082d4bffbfa6964c07cd7c764595
Description: AirPlay audio player
 Plays audio streamed from iTunes, iOS devices and third-party AirPlay
 sources such as ForkedDaapd and others. Audio played by a Shairport
 Sync-powered device stays synchronised with the source and hence with
 similar devices playing the same source. In this way, synchronised
 multi-room audio is possible without difficulty.
 .
 Shairport Sync does not support AirPlay video or photo streaming.
Homepage: https://github.com/mikebrady/shairport-sync

It seems that it has a dependency on libdaemon. Maybe I should remove the Debian version and do a full install as per your build instructions instead of swapping out the binaries to get a quick fix.

Thanks for the updates. Yes indeed, a full installation is a good idea, and a full removal of old scripts is important. There is some guidance on the INSTALL.md page.

Just chiming in here, compiling latest master with the following options does not seem to include libdaemon:
./configure --with-alsa --with-avahi --with-libdaemon --with-soxr --with-apple-alac --with-convolution --with-ssl=openssl --sysconfdir=/etc

At the linking step -ldaemon is missing:

g++ -fno-common -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"/etc\" -std=c++11 -g -O2   -o shairport-sync shairport.o rtsp.o mdns.o common.o rtp.o player.o alac.o audio.o loudness.o activity_monitor.o apple_alac.o mdns_avahi.o   audio_alsa.o         FFTConvolver/AudioFFT.o FFTConvolver/FFTConvolver.o FFTConvolver/Utilities.o FFTConvolver/convolver.o         -lsndfile -lasound -lavahi-common -lavahi-client -lsoxr -lssl -lcrypto -L/usr/local/lib -lalac -lconfig -lpopt -lm -lpthread -lrt

If I checkout to 4856fefa830962be6b2d5a8fee30782d1bfdba50 and run the same ./configure options, it works fine.

Thanks. I'll check.

Apologies for the delay., I can confirm the missing -ldaemon. I'll fix it shortly.

Hello again @aleszczynskig and @xska2. I believe it is fixed now on the development branch. If you'd be kind enough to check it, that would be great.

Confirmed development branch looks good on my end.

Confirmed it's working for me too. Many thanks.

Thanks guys.

Thanks guys.

I finally got shairport-sync working on my Asus RT-AC86U running Asuswrt-merlin using Entware! I will be writing a guide (a very long one) on how to achieve this soon.

The last version available on Entware to support daemonisation using the -d, --daemon, -j or --justDaemoniseNoPIDFile options is 3.2.2-3

Newer releases below are "broken":
3.3.5-1
3.3.6-2
3.3.7-1

So for users running Entware, if daemonisation is required, manually install version 3.2.2-3

wget https://bin.entware.net/armv7sf-k3.2/archive/shairport-sync-openssl_3.2.2-3_armv7-3.2.ipk
opkg install shairport-sync-openssl_3.2.2-3_armv7-3.2.ipk

Since Entware syncs with OpenWrt, these notes may somewhat also apply to OpenWrt!

@mikebrady When do you think the next release is due for?

Update:

I compiled the latest development version, 3.3.8d7 for Entware

shairport-sync -V
# 3.3.8d7-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/opt/etc
shairport-sync -d -- -d hw:0,0 -m hw:0 -c PCM
# shairport-sync was built without libdaemon, so does not support daemonisation using the -d, --daemon, -j or --justDaemoniseNoPIDFile options

I guess it wasn't solved yet on latest development branch???

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PeterPablo picture PeterPablo  路  8Comments

rockrabbit picture rockrabbit  路  6Comments

wysiecki picture wysiecki  路  4Comments

moritzmhmk picture moritzmhmk  路  6Comments

purefan picture purefan  路  5Comments