Closed atebeta closed 2 years ago
Thanks for the post. Let me suggest that you start over and, making sure your Pi4 is fully up to date on Buster or Bullseye, follow the guide at BUILDFORAP2.md. The versions of Shairport Sync and NQPTP must match up -- you'll get a runtime error message if there's a problem.
The missing library libavformat
is actually included in the list of tools and libraries to be loaded, which is different for AirPlay 2 to those needed for AirPlay 1.
Just FYI, ports 319, 320 and 9000 should be open for UDP packets. Timing is critically dependent on these ports offering minimal propagation delays.
Good luck!
Hi thanks for your reply. I followed all the steps exactly from BUILDFORAP2.md and I have all the dependencies. I tried again after updating to Bullseye, but I'm still getting the same error. If I try to install libavformat-dev
it just tells me it is already installed.
libavformat-dev is already the newest version (7:4.3.3-0+rpt2+deb11u1).
Also, as mentioned, when I used a slightly older version of the configure.ac file (from the development branch) it installs fine. I also already had 319, 320, and 9000 open for both UDP and TPC packets.
So the issues I’m facing is that with the most recent configure.ac
file I can’t get past the ./configure...
step with the the --with-airplay-2
flag even though I have libavformat
installed.
If I use the old configure.ac
file it will install and run, but I'm only able to connect if I disable my firewall even though ports 319, 320 and 9000 are open. If I do this I can connect, but it will crash as per above when I try to play something.
The biggest issue though is obviously that there is something with the configure.ac
file which makes it not recognise that I have libavformat-dev
installed.
I was able to make it work by commenting out line 422 of configure.ac
which checks for libavformat
:
AC_CHECK_LIB([avformat],[avformat_new_stream], [], [AC_MSG_ERROR([AirPlay 2 support requires libavformat -- libavformat-dev suggested])])
after this it wouldn't complete.
make -j
and gave me this error:
/usr/bin/ld: /usr/local/lib/libavcodec.a(libx264.o): in function X264_init:
/home/pi/FFmpeg/libavcodec/libx264.c:922: undefined reference to x264_encoder_open_155
/usr/bin/ld: /usr/local/lib/libavcodec.a(libx265.o): in function libx265_encode_init_csp:
/home/pi/FFmpeg/libavcodec/libx265.c:642: undefined reference to x265_api_get_165
/usr/bin/ld: /home/pi/FFmpeg/libavcodec/libx265.c:644: undefined reference to x265_api_get_165
/usr/bin/ld: /home/pi/FFmpeg/libavcodec/libx265.c:646: undefined reference to x265_api_get_165
/usr/bin/ld: /usr/local/lib/libavcodec.a(libx265.o): in function libx265_encode_init:
/home/pi/FFmpeg/libavcodec/libx265.c:124: undefined reference to x265_api_get_165
/usr/bin/ld: /home/pi/FFmpeg/libavcodec/libx265.c:126: undefined reference to x265_api_get_165
/usr/bin/ld: rtp.o: in function rtp_buffered_audio_processor:
/home/pi/shairport-sync/rtp.c:2132: undefined reference to avcodec_register_all
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:827: shairport-sync] Error 1
make[2]: Leaving directory '/home/pi/shairport-sync'
make[1]: *** [Makefile:1066: all-recursive] Error 1
make[1]: Leaving directory '/home/pi/shairport-sync'
make: *** [Makefile:660: all] Error 2
so I recompiled and installed FFmpeg after which make -j
worked. Now I am running:
4.1-dev-141-g30472850-dirty-AirPlay2-OpenSSL-Avahi-ALSA-pa-pipe-soxr-metadata-mqtt-sysconfdir:/etc
I still had to comment out line 422 for it to work even after recompiling and and reinstalling FFmpeg
, so not quite sure what is going on there, but at least I got it to work. I was able to add my speaker to Homekit and the audio on Youtube doesn't stop playing after 10 seconds. Thanks.
Thanks -- I'm glad you got it to work eventually. I really don't understand why the problem arose, I'm afraid. But see also Issue 1361.
Just looking through the error messages above, it seems that the linker was looking for locally-compiled libav...
stuff (and looking for it in the /usr/local/lib
directory). Is it possible that you might have built some AV stuff in the past and had to build a library locally? I note that you solved it by building and installing FFmpeg
locally. On my machines, there is nothing libav...
-related in /usr/local/lib
. In fact, there is very little in there...
Yeah, I think I needed some additional libraries so I had followed this tutorial to install ffmpeg previously.
I also followed it when I reinstalled it.
Yeah, I think I needed some additional libraries so I had followed this tutorial to install ffmpeg previously.
I also followed it when I reinstalled it.
Thanks -- that might explain how the problem arose.
Yeah, I'm guessing it would have built if I had just commented out line 422 before upgrading to bullseye. I didn't do a clean install so a few things were broken after. I still don't quite understand why it built when I used to older the configure.ac file.
This issue has been inactive for 45 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.
I have the same problem but I'm not able to make it work. I am trying to install Shairport Sync with Airplay 2. I tried to reinstall ffmpeg, compiling with source code and with default package, but neither of those options worked for me. I also uninstalled and reinstalled the pages that were asked for, but it changed nothing.
I really would want to reinstall all from zero, but I have a bunch of customisations and services running in the RPi 4 that I don't want to lose.
Is there anything that I can do to compile with Airplay2? It works without the Airplay2 flag.
The error is:
checking for gcry_control in -lgcrypt... yes
checking for libavutil... yes
checking for libavcodec... no
configure: error: AirPlay 2 support requires libavcodec -- libavcodec-dev suggested
But if I try to install libavcodec, I get:
$ sudo apt-get install libavcodec-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libavcodec-dev is already the newest version (7:4.1.9-0+deb10u1+rpt1).
Thanks. Could you run $ shairport-sync --displayConfig
even on the non-AirPlay-2 version and post the results please? It will give us an idea of the system you are using.
Thanks for the quick response. Yes of course :)
>> Display Config Start.
From "uname -a":
Linux raspberrypi4 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l GNU/Linux
From /etc/os-release:
Raspbian GNU/Linux 10 (buster)
From /sys/firmware/devicetree/base/model:
Raspberry Pi 4 Model B Rev 1.1
Shairport Sync Version String:
4.1-4-g99e76fdf-OpenSSL-Avahi-ALSA-soxr-metadata-mqtt-sysconfdir:/etc
Command Line:
shairport-sync --displayConfig
Configuration File:
/etc/shairport-sync.conf
Configuration File Settings:
general :
{
name = "Minicadena Comedor %v";
volume_range_db = 60;
};
sessioncontrol :
{
run_this_before_play_begins = "/usr/bin/python3 /opt/custom_scripts/startHiFiforRPi.py";
run_this_after_play_ends = "/usr/bin/python3 /opt/custom_scripts/stopHiFiforRPi.py";
};
alsa :
{
output_device = "hw:0";
mixer_device = "PCM";
};
mqtt :
{
enabled = "yes";
hostname = "172.16.0.100";
port = 1883;
topic = "house/livingRoom/minicadena";
publish_parsed = "yes";
publish_cover = "yes";
enable_remote = "yes";
};
>> Display Config End.
>> Goodbye!
Thanks. Let me check this out.
Thanks for the help. It is really appreciated.
Thanks — it’ll be tomorrow though, it’s later here in Ireland…
Before you try the rest of this suggestion, consider this: Since you have compiled FFmpeg
locally, you may simply need to tell the linker about it. See here for a similar situation having build libalac
locally.
Okay, if that doesn't work, then there's an update (in the development
branch) that tries a little harder to find libavcodec
. If you switch to the development
branch, pull the updates and go through the autoconf...
and ./configure...
again, and see what happens -- hopefully you'll get further along.
It's all a bit peculiar, because Shairport Sync normally builds on this system without issue and the libraries are accessible though pkg-config
:
$ pkg-config --list-all | grep libav
libavformat libavformat - FFmpeg container format library
libavcodec libavcodec - FFmpeg codec library
libavutil libavutil - FFmpeg utility library
...so I guess it's because FFmpeg
was built locally and the build system can't find it.
It works like a charm now! 🎉 Thanks!
Let me explain what I have tried and what worked at the end (for me), so if anyone finds this issue he is able to try what worked for me.
sudo ldconfig
, and it was available to other programs, but libraries were not found for shairport sync--enable-shared
flag when running configure
, and I used sudo ldconfig
after on each library. That did the trick.I leave here the three scripts I created to do all this stuff, so people is able to copy/paste 😉
BTW, thanks for the help, I have already invited you to a coffee, is the least I can do.
Many thanks for the comprehensive report (and the coffee!). Hopefully your scripts will be useful to future users.
When I try to run
it fails at with the following error:
I was able to get it to build by rolling back the
configure.ac
file to commit7693b4a
from 5th December. I could now install and run Shairport-sync, but I was unable to connect to the speaker even though I opened port 319 and 320. I was able to connect after disabling UFW, but whenever I tried to play something Shairport would crash with the following error.Not sure what the issue is. I'm able to run the stable version fine (with UFW enabled), but I just got an AppleTV so would like to try the Airplay2 version.