FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.35k stars 72 forks source link

Uxplay support on Raspberry Pi OS legacy (Buster) , R Pi 4B; Make failed: Undefined reference to `plist_get_string_ptr' #202

Closed aegjoyce closed 1 year ago

aegjoyce commented 1 year ago

Struggling with installation on a Pi 4B using fresh install of Raspberry Pi OS Lite Legacy (Buster).

Followed all instructions and getting as far as the make instruction but encountering an error I can't seem to fix - see build logs below:

pi@raspberrypi:~/UxPlay $ make
Scanning dependencies of target playfair
[  3%] Building C object lib/playfair/CMakeFiles/playfair.dir/hand_garble.c.o
[  6%] Building C object lib/playfair/CMakeFiles/playfair.dir/modified_md5.c.o
[  9%] Building C object lib/playfair/CMakeFiles/playfair.dir/omg_hax.c.o
[ 12%] Building C object lib/playfair/CMakeFiles/playfair.dir/playfair.c.o
[ 15%] Building C object lib/playfair/CMakeFiles/playfair.dir/sap_hash.c.o
[ 18%] Linking C static library libplayfair.a
[ 18%] Built target playfair
Scanning dependencies of target llhttp
[ 21%] Building C object lib/llhttp/CMakeFiles/llhttp.dir/api.c.o
[ 24%] Building C object lib/llhttp/CMakeFiles/llhttp.dir/http.c.o
[ 27%] Building C object lib/llhttp/CMakeFiles/llhttp.dir/llhttp.c.o
[ 30%] Linking C static library libllhttp.a
[ 30%] Built target llhttp
Scanning dependencies of target airplay
[ 33%] Building C object lib/CMakeFiles/airplay.dir/byteutils.c.o
[ 36%] Building C object lib/CMakeFiles/airplay.dir/crypto.c.o
[ 39%] Building C object lib/CMakeFiles/airplay.dir/dnssd.c.o
[ 42%] Building C object lib/CMakeFiles/airplay.dir/fairplay_playfair.c.o
[ 45%] Building C object lib/CMakeFiles/airplay.dir/http_request.c.o
[ 48%] Building C object lib/CMakeFiles/airplay.dir/http_response.c.o
[ 51%] Building C object lib/CMakeFiles/airplay.dir/httpd.c.o
[ 54%] Building C object lib/CMakeFiles/airplay.dir/logger.c.o
[ 57%] Building C object lib/CMakeFiles/airplay.dir/mirror_buffer.c.o
[ 60%] Building C object lib/CMakeFiles/airplay.dir/netutils.c.o
[ 63%] Building C object lib/CMakeFiles/airplay.dir/pairing.c.o
[ 66%] Building C object lib/CMakeFiles/airplay.dir/raop.c.o
In file included from /home/pi/UxPlay/lib/raop.c:87:
/home/pi/UxPlay/lib/raop_handlers.h: In function ‘raop_handler_setup’:
/home/pi/UxPlay/lib/raop_handlers.h:452:27: warning: implicit declaration of function ‘plist_get_string_ptr’; did you mean ‘plist_get_string_val’? [-Wimplicit-function-declaration]
         timing_protocol = plist_get_string_ptr(req_timing_protocol_node, &string_len);
                           ^~~~~~~~~~~~~~~~~~~~
                           plist_get_string_val
/home/pi/UxPlay/lib/raop_handlers.h:452:25: warning: assignment to ‘const char ’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
         timing_protocol = plist_get_string_ptr(req_timing_protocol_node, &string_len);
                         ^
[ 69%] Building C object lib/CMakeFiles/airplay.dir/raop_buffer.c.o
[ 72%] Building C object lib/CMakeFiles/airplay.dir/raop_ntp.c.o
[ 75%] Building C object lib/CMakeFiles/airplay.dir/raop_rtp.c.o
[ 78%] Building C object lib/CMakeFiles/airplay.dir/raop_rtp_mirror.c.o
[ 81%] Building C object lib/CMakeFiles/airplay.dir/utils.c.o
[ 84%] Linking C static library libairplay.a
[ 84%] Built target airplay
Scanning dependencies of target renderers
[ 87%] Building C object renderers/CMakeFiles/renderers.dir/audio_renderer_gstreamer.c.o
[ 90%] Building C object renderers/CMakeFiles/renderers.dir/video_renderer_gstreamer.c.o
[ 93%] Linking C static library librenderers.a
[ 93%] Built target renderers
Scanning dependencies of target uxplay
[ 96%] Building CXX object CMakeFiles/uxplay.dir/uxplay.cpp.o
[100%] Linking CXX executable uxplay
/usr/bin/ld: lib/libairplay.a(raop.c.o): in function `raop_handler_setup':
raop.c:(.text+0x1588): undefined reference to `plist_get_string_ptr'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/uxplay.dir/build.make:100: uxplay] Error 1
make[1]: *** [CMakeFiles/Makefile2:190: CMakeFiles/uxplay.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
fduncanh commented 1 year ago

(RPI legacy OS Buster) isnt explicitly supported, (has not been tested) I'm afraid. (But since Buster (Debian 10 ) is supported it should work

Buster's libplist is too old. Install "libplist3" and libplist-dev

See the README instructions, which say

Make sure that your distribution provides OpenSSL 1.1.1 or later, and libplist 2.0 or later. (This means Debian 10 "Buster" based systems (e.g, Ubuntu 18.04) or newer; on Debian 10 systems "libplist" is an older version, you need "libplist3".)

fduncanh commented 1 year ago

will do a test on RPi OS legacy for you EDIT: The function plist_get_string_ptr() is from libplist-2.1.0, but Debian 10 (Buster) provides libplist-2.0.0.

I converted the recent change that used this, to use an older form plist_get_string_val() that is in libplist-2.0.0 to restore compatibility with Debian 10 (Buster) systems.

get the latest github version, it will now build on R Pi legacy OS (Buster).

It works with "uxplay -vs glimagesink" (install gstreamer1.0-gl) , but without GPU hardware video decoding so far.

fduncanh commented 1 year ago

If GStreamer is older than 1.18.4 there are no patches to make video4linux2 work with the Pi's GPU.

you would have to build a newer gstreamer from source:

Edit: yes Buster only has gstreamer-1.14

see how to build a newer gstreamer

fduncanh commented 1 year ago

RPi legacy OS Buster has legacy omx support, (32 bit only) so

uxplay -vs glimagesink -vd omxh264dec

should access the GPU to get hardware video decoding, but I haven't yet worked out how to install Buster's OMX (OpenMAX) library (I get an error "Could not initialize supporting library")

I have checked that gstreamer1.0-omx-rpi-config and gstreamer1.0-omx-rpi and gstreamer1.0-omx are installed, and gst-inspect-1.0 shows omx support in gstreamer, so I am not sure what is missing. (I have no omx experience, UxPlay uses video4linux2 to access the RPi GPU in Rpi OS Bullseye, which dropped support for omx in favor of v4l2)

https://raspberrypi.stackexchange.com/questions/528/how-can-i-install-gstreamer-gst-omx

fduncanh commented 1 year ago

Why not upgrade to Rpi OS Bullseye?

fduncanh commented 1 year ago

I think your original issue (libplist) is fixed.

Fell free to post further issues as new issues.

aegjoyce commented 1 year ago

Thanks. Wanted Buster as planning on installing this with RetroPie which currently doesn't support Bullseye. Had already installed libplist3 and libplist-dev. Managed to install on Ubuntu Server 22.04.2 LTS but then wasn't able to get a stream to display and couldn't get the gstreamer patch to work. Thank you so much for taking the time to test and fix this! I am just trying it again on Ubuntu Server 23.04 to see if I can get it working without the gstreamer patching and then will go back and test your changes on Buster

fduncanh commented 1 year ago

In principle the gstreamer support for omx with "uxplay -vd omxh264dec -vs glimagesink" ought to give access to the GPU in R Pi OS Buster legacy with gstreamer-1.14, but I don't know if it is in fact working, and if so what else needs to be installed. I guess, maybe test if omxplayer is working first?. omx is old and unmaintained.

EDIT: without X running (lite version) use -vs kmssink.

To upgrade gstreamer, I would try to build gstreamer-1.18.4 plus the patch, this is what is on R Pi OS Bullseye.

fduncanh commented 1 year ago

On Ubuntu server (no X11) use -vs kmssink.

fduncanh commented 1 year ago

GST_DEBUG=2 shows

 uxplay -vs glimagesink  -vd omxh264dec
UxPlay 1.65: An Open-Source AirPlay mirroring and audio-streaming server.
0:00:00.923647841 17499  0x1b287a0 ERROR    

 omx gstomx.c:799:gst_omx_component_new:<omxh264dec-omxh264dec0> Failed to get component handle 

'OMX.broadcom.egl_render' from core '/opt/vc/lib/libopenmaxil.so': 0x80001000

not sure what fix is needed for omx support.

(using glimagesink becasue this is desktop system with X11, not lite)

fduncanh commented 1 year ago

The thread https://github.com/raspberrypi/firmware/issues/1426 contains a definitive statement from 6by9 (R Pi staff person), so omxh264dec is broken on R Pi 4 (in firmware). Presumably it works on R Pi 3b+ (I'll check)

omxh264dec is broken on Pi4 as they try to merge video_decode with the firmware GLES egl_render component, the latter of which is incompatible with the updated 3D block on the Pi4.

The recommendation is to switch from the OMX codec components to the V4L2 ones as they are also more efficient in terms of copying behaviour. It's the same underlying encoder/decoder, but the frameworks allow more efficient buffer passing.

fduncanh commented 1 year ago

Yes, when I put the sd card in a R Pi 3b+, omxh264dec worked, so the firmware on RPi 4 is the problem, as stated by 6by9.

On R Pi OS Legacy (Buster), OMX-based RPiPlay should work (without gstreamer) , but doesnt have the many enhancements in UxPlay. https://github.com/FD-/RPiPlay Presumbably it is only GStreamer-1.14 omx support that is broken by RPi 4B firmware changes.

fduncanh commented 1 year ago

@aegjoyce

Did you solve anything?

So its clear you need to build an updated gstreamer on Buster/lite (I tried on Buster/desktop but there is too much that depends on GStreamer-1.14 supplied with Buster.)

I will attempt this and see if its possible on Lite when I have some time

fduncanh commented 1 year ago

@aegjoyce

1.18.6 is a good compromise (not too old to patch, not too new, the final release in the 1.18.x series)

I updated the instructions for doing this.

aegjoyce commented 1 year ago

Thanks for putting so much effort into this, I'm worried it's wasted on my stupid brain.

I'm unsure which order I should do everything in now - there's a) the UxPlay installation instructions, b) the new building gstreamer instructions, and c) the gstreamer patching instructions - what is the correct order to do all this in on a new Buster build?

First build the GStreamer 1.18.6 per instructions. (The patching is part of these instructions).

Then build UxPlay, skipping an installation of gstreamer packages.

I just reworded the README and gstreamer building instructions to hopefully make things clearer

aegjoyce commented 1 year ago

SUCCESS! Thank you so much, up and running just with command uxplay and works so much better than the app I installed on my android TV out of desperation :D

fduncanh commented 1 year ago

glad to hear it! It was good to find out that UxPlay runs well on Raspberry Pi OS Legacy (Buster) too, with model 4B

aegjoyce commented 1 year ago

I might save an image for later - compiling gstreamer took nearly an hour!!

fduncanh commented 1 year ago

If you went through the time-consuming procedure for upgrading cmake, I found it is not necessary, cmake-1.16 is just fine with current meson (a future meson may refuse to use it)

fduncanh commented 1 year ago

@aegjoyce

I cleaned up the instructions for building gstreamer from source, and added a few more plugins dependencies, (which may or may not be useful.)

If you install some of the extra lib*-dev files, you can then update your build with

cd build
ninja reconfigure
ninja
sudo ninja install

without rebuilding everything.

see the build instructions page