nicokaiser / rpi-audio-receiver

Raspberry Pi Audio Receiver with Bluetooth A2DP, AirPlay 2, and Spotify Connect
MIT License
1.37k stars 148 forks source link

shairport-sync.service: libalac.so.0 not found #105

Closed TwizzyDizzy closed 3 years ago

TwizzyDizzy commented 3 years ago

Hi @nicokaiser

just used this repo to set up Bluetooth audio pairing / Airplay on my Raspberry Pi 3 B on Raspberry Pi OS Lite Buster at commit https://github.com/nicokaiser/rpi-audio-receiver/commit/26d6a31fbf3732825a5969cc1b60202c985e3756 of this repo.

One thing that did not work out of the box: Airplay. shairport-sync.service did not start with a complaint that it could not load libalac.so.0.

It seems as though the compiled version of libalac is put into /usr/local/lib ... the LD_LIBRARY_PATH used by the shairplay-sync.service does not seem to contain this path though, so we have to set in the shairport-sync.service:

systemctl edit shairport-sync.service

[put the line with 'Environment=' in there]

# /etc/systemd/system/shairport-sync.service.d/override.conf
[Service]
# Avahi daemon needs some time until fully ready
ExecStartPre=/bin/sleep 3
Environment=LD_LIBRARY_PATH=/usr/local/lib

Cheers Thomas

TwizzyDizzy commented 3 years ago

Submitted a PR to address this, see comments there: https://github.com/nicokaiser/rpi-audio-receiver/pull/106

nicokaiser commented 3 years ago

This is strange, since shairport-sync is also compiled from source (thus, installed to /usr/local/bin/shairport-sync), so it should find its libraries in /usr/local/lib.

I'll try to install a fresh version of the script to see what's wrong and if the LD_LIBRARY_PATH is really needed...

nicokaiser commented 3 years ago

@TwizzyDizzy Can you check if this works: the current install script I just pushed runs ldconfig after installing alac. This should fix the issue without needing to provide a LD_LIBRARY_PATH.

TwizzyDizzy commented 3 years ago

Yeah, this solution is to be preferred over the workaround in the systemd unit, which is what I meant with

Might also be solved by configureing different LDFLAGS here: e579b0e.

in the PR.

I'll give it a spin with a spare SD and your pushed version (probably tomorrow) and report back.

Cheers Thomas

TwizzyDizzy commented 3 years ago

Ah.. did it now so we can finish this: can confirm, your ldconfig does the trick.

This works due to:

root@livingroom:~# cat /etc/ld.so.conf.d/libc.conf 
# libc default configuration
/usr/local/lib

The output of ldd now shows: libalac.so.0 is found:

root@raspberrypi:/opt/rpi-audio-receiver# ldd /usr/local/bin/shairport-sync
...
    libssl.so.1.1 => /lib/arm-linux-gnueabihf/libssl.so.1.1 (0x769a5000)
    libcrypto.so.1.1 => /lib/arm-linux-gnueabihf/libcrypto.so.1.1 (0x7678b000)
    libalac.so.0 => /usr/local/lib/libalac.so.0 (0x76772000)
    libconfig.so.9 => /lib/arm-linux-gnueabihf/libconfig.so.9 (0x76758000)
    libpopt.so.0 => /lib/arm-linux-gnueabihf/libpopt.so.0 (0x7673d000)
...

Cheers Thomas