Since 19.08 krfb provides a pipewire plugin. This is not built/installed in the neon package. Due to that krfb errors out when used on Wayland.
This gets a compile failure when I try it on the build server and my local computer http://paste.ubuntu.com/p/bYMB2Wj4jj/ https://build.neon.kde.org/job/bionic_unstable_kde_krfb_bin_amd64/84/console [ 85%] Building CXX object framebuffers/pipewire/CMakeFiles/krfb_framebuffer_pw.dir/pw_framebuffer.cpp.o cd /home/jr/src/kde/krfb/kdegit/krfb/build/framebuffers/pipewire && /usr/bin/c++ -DKCOREADDONS_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050600 -DQT_GUI_LIB -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_QSTRINGBUILDER -DQT_WIDGETS_LIB -DQT_X11EXTRAS_LIB -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -Dkrfb_framebuffer_pw_EXPORTS -I/home/jr/src/kde/krfb/kdegit/krfb/build/framebuffers/pipewire -I/home/jr/src/kde/krfb/kdegit/krfb/framebuffers/pipewire -I/home/jr/src/kde/krfb/kdegit/krfb/build/framebuffers/pipewire/krfb_framebuffer_pw_autogen/include -I/home/jr/src/kde/krfb/kdegit/krfb -I/home/jr/src/kde/krfb/kdegit/krfb/build -I/home/jr/src/kde/krfb/kdegit/krfb/build/krfb -I/home/jr/src/kde/krfb/kdegit/krfb/krfb -I/home/jr/src/kde/krfb/kdegit/krfb/krfb/ui -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtDBus -isystem /usr/include/KF5/KCoreAddons -isystem /usr/include/KF5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtX11Extras -std=c++0x -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -std=gnu++11 -o CMakeFiles/krfb_framebuffer_pw.dir/pw_framebuffer.cpp.o -c /home/jr/src/kde/krfb/kdegit/krfb/framebuffers/pipewire/pw_framebuffer.cpp In file included from /usr/include/pipewire/protocol.h:33:0, from /usr/include/pipewire/proxy.h:99, from /usr/include/pipewire/interfaces.h:32, from /usr/include/pipewire/pipewire.h:31, from /home/jr/src/kde/krfb/kdegit/krfb/framebuffers/pipewire/pw_framebuffer.cpp:39: /usr/include/pipewire/utils.h: In function ‘spa_pod* pw_spa_pod_copy(const spa_pod*)’: /usr/include/pipewire/utils.h:61:17: error: invalid conversion from ‘void*’ to ‘spa_pod*’ [-fpermissive] if ((c = malloc(size)) == NULL) ~~~~~~^~~~~~
Groovy it just needed a newer pipewire. krfb built with it now (will be available in User with next Snapshot which is waiting on new Qt building)
Unfortunately it is still not working: Using FrameBuffer: "pw" Initializing D-Bus connectivity with XDG Desktop Portal Unsupported XDG Portal screencast interface version: 0 No valid framebuffer found. returning null. QObject::connect(FrameBuffer, RfbServerManager): invalid null parameter Unable to get rbfserver screen --- It looks to me like we also need an updated xdg-desktop-portal.
xdg-desktop-portal 1.4.2 is now in neon
Weird, I still get the same error and looking in qdbusviewer it indeed does not have the required interface.
I think I found it :-) 20:44:10 dh_auto_configure -- \ 20:44:10 --enable-docbook-docs \ 20:44:10 --enable-geoclue \ 20:44:10 --enable-installed-tests \ 20:44:10 --disable-pipewire \ From https://build.neon.kde.org/job/bionic_unstable_backports-bionic_xdg-desktop-portal_bin_amd64/1/console I guess --disable-pipewire disables pipewire support which is required for screencast.
Well spotted, that's it added back in now ready for re-testing
Another step in the right direction, but we are still not there :-( Krfb starts now without an error message, but in log I see: "Failed to create session: 2" and as soon as a client connects, krfb crashes. I do not know whether something is still missing or whether this is a bug in krfb. I'll try to investigate.
And I think I found it. xdg-desktop-portal-kde also needs the pipewire dependency. From build.neon log: -- The following features have been disabled: 02:36:40 02:36:40 * Screencast portal, Support for screen sharing 02:36:40 02:36:40 -- The following OPTIONAL packages have not been found: 02:36:40 02:36:40 * PipeWire, PipeWire - multimedia processing, <http://www.pipewire.org> 02:36:40 Required for screencast portal 02:36:40 * GBM, Mesa gbm library., <http://www.mesa3d.org> 02:36:40 Required for screencast portal 02:36:40 * Epoxy, libepoxy, <http://github.com/anholt/libepoxy> 02:36:40 Required for screencast portal
Thanks for the continued issue finding! That's those build-deps added to xdg-desktop-portal-kde now https://build.neon.kde.org/job/bionic_unstable_kde_xdg-desktop-portal-kde/
Yet another step, but still no success. We get a dialog from xdg-desktop-portal-kde asking whether we want to allow and then a crash :-( Application: xdg-desktop-portal-kde (xdg-desktop-portal-kde), signal: Segmentation fault Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [Current thread is 1 (Thread 0x7f6c34041800 (LWP 29437))] Thread 5 (Thread 0x7f6c14995700 (LWP 29986)): #0 0x00007f6c2b9c29f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55e72523a408) at ../sysdeps/unix/sysv/linux/futex-internal.h:88 #1 __pthread_cond_wait_common (abstime=0x0, mutex=0x55e72523a3b8, cond=0x55e72523a3e0) at pthread_cond_wait.c:502 #2 __pthread_cond_wait (cond=0x55e72523a3e0, mutex=0x55e72523a3b8) at pthread_cond_wait.c:655 #3 0x00007f6c1e3b42cb in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so #4 0x00007f6c1e3b3ff7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so #5 0x00007f6c2b9bc6db in start_thread (arg=0x7f6c14995700) at pthread_create.c:463 #6 0x00007f6c2f46488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 4 (Thread 0x7f6c16236700 (LWP 29440)): #0 0x00007f6c28912649 in g_mutex_lock () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #1 0x00007f6c288cbfec in g_main_context_check () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007f6c288cc570 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00007f6c288cc6dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #4 0x00007f6c2fdaa9db in QEventDispatcherGlib::processEvents (this=0x7f6c0c000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:425 #5 0x00007f6c2fd4aeaa in QEventLoop::exec (this=this@entry=0x7f6c16235da0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225 #6 0x00007f6c2fb663ca in QThread::exec (this=<optimized out>) at thread/qthread.cpp:531 #7 0x00007f6c2fb67b72 in QThreadPrivate::start (arg=0x55e72500c8c0) at thread/qthread_unix.cpp:360 #8 0x00007f6c2b9bc6db in start_thread (arg=0x7f6c16236700) at pthread_create.c:463 #9 0x00007f6c2f46488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 3 (Thread 0x7f6c1d0e1700 (LWP 29439)): #0 0x00007f6c2b9c29f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55e724e9c4e8) at ../sysdeps/unix/sysv/linux/futex-internal.h:88 #1 __pthread_cond_wait_common (abstime=0x0, mutex=0x55e724e9c498, cond=0x55e724e9c4c0) at pthread_cond_wait.c:502 #2 __pthread_cond_wait (cond=0x55e724e9c4c0, mutex=0x55e724e9c498) at pthread_cond_wait.c:655 #3 0x00007f6c1e3b42cb in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so #4 0x00007f6c1e3b3ff7 in ?? () from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so #5 0x00007f6c2b9bc6db in start_thread (arg=0x7f6c1d0e1700) at pthread_create.c:463 #6 0x00007f6c2f46488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 2 (Thread 0x7f6c1f84d700 (LWP 29438)): #0 0x00007f6c2f457bf9 in __GI___poll (fds=0x7f6c18003ce0, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29 #1 0x00007f6c288cc5c9 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #2 0x00007f6c288cc6dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #3 0x00007f6c2fdaa9db in QEventDispatcherGlib::processEvents (this=0x7f6c18000b20, flags=...) at kernel/qeventdispatcher_glib.cpp:425 #4 0x00007f6c2fd4aeaa in QEventLoop::exec (this=this@entry=0x7f6c1f84cd70, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225 #5 0x00007f6c2fb663ca in QThread::exec (this=<optimized out>) at thread/qthread.cpp:531 #6 0x00007f6c314bd0e5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 #7 0x00007f6c2fb67b72 in QThreadPrivate::start (arg=0x7f6c31734d80) at thread/qthread_unix.cpp:360 #8 0x00007f6c2b9bc6db in start_thread (arg=0x7f6c1f84d700) at pthread_create.c:463 #9 0x00007f6c2f46488f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 Thread 1 (Thread 0x7f6c34041800 (LWP 29437)): [KCrash Handler] #6 0x00007f6c33024c21 in pw_thread_loop_new (loop=0x0, name=name@entry=0x55e72390cd22 "pipewire-main-loop") at ../src/pipewire/thread-loop.c:128 #7 0x000055e7238f056e in ScreenCastStream::init (this=this@entry=0x55e725487f80) at ./src/screencaststream.cpp:294 #8 0x000055e7238fefcf in WaylandIntegration::WaylandIntegrationPrivate::startStreaming (this=0x55e723b1f460 <(anonymous namespace)::Q_QGS_globalWaylandIntegration::innerFunction()::holder>, outputName=<optimized out>) at ./src/waylandintegration.cpp:243 #9 0x000055e7238f7254 in RemoteDesktopPortal::Start (this=<optimized out>, handle=..., session_handle=..., app_id=..., parent_window=..., options=..., results=...) at ./src/remotedesktop.cpp:129 #10 0x000055e7239046b8 in RemoteDesktopPortal::qt_static_metacall (_o=_o@entry=0x55e724eb97e0, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=2, _a=_a@entry=0x7ffd06869930) at ./obj-x86_64-linux-gnu/src/xdg-desktop-portal-kde_autogen/EWIEGA46WW/moc_remotedesktop.cpp:149 #11 0x000055e723904fb5 in RemoteDesktopPortal::qt_metacall (this=0x55e724eb97e0, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7ffd06869930) at ./obj-x86_64-linux-gnu/src/xdg-desktop-portal-kde_autogen/EWIEGA46WW/moc_remotedesktop.cpp:294 #12 0x00007f6c314c8138 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 #13 0x00007f6c314cd080 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 #14 0x00007f6c314cd9fc in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 #15 0x00007f6c314d01de in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 #16 0x00007f6c2fd7e272 in QObject::event (this=0x55e724eba210, e=<optimized out>) at kernel/qobject.cpp:1260 #17 0x00007f6c30b51eac in QApplicationPrivate::notify_helper (this=this@entry=0x55e724e6d180, receiver=receiver@entry=0x55e724eba210, e=e@entry=0x7f6c180170e0) at kernel/qapplication.cpp:3703 #18 0x00007f6c30b594b0 in QApplication::notify (this=0x7ffd0686a170, receiver=0x55e724eba210, e=0x7f6c180170e0) at kernel/qapplication.cpp:3449 #19 0x00007f6c2fd4cd48 in QCoreApplication::notifyInternal2 (receiver=0x55e724eba210, event=0x7f6c180170e0) at kernel/qcoreapplication.cpp:1095 #20 0x00007f6c2fd4cf1e in QCoreApplication::sendEvent (receiver=<optimized out>, event=event@entry=0x7f6c180170e0) at kernel/qcoreapplication.cpp:1490 #21 0x00007f6c2fd4f667 in QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x55e724e6b7d0) at kernel/qcoreapplication.cpp:1840 #22 0x00007f6c2fd4fbf8 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1694 #23 0x00007f6c2fdab3a3 in postEventSourceDispatch (s=0x55e724e93b90) at kernel/qeventdispatcher_glib.cpp:277 #24 0x00007f6c288cc417 in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #25 0x00007f6c288cc650 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #26 0x00007f6c288cc6dc in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #27 0x00007f6c2fdaa9bf in QEventDispatcherGlib::processEvents (this=0x55e724efa110, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #28 0x00007f6c2fd4aeaa in QEventLoop::exec (this=this@entry=0x7ffd0686a0f0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225 #29 0x00007f6c2fd54220 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1403 #30 0x000055e7238ad595 in main (argc=<optimized out>, argv=<optimized out>) at ./src/xdg-desktop-portal-kde.cpp:48
Running xdg-desktop-portal-kde from command line gives the right hint: can't load /usr/lib/x86_64-linux-gnu/spa/support/libspa-support.so: /usr/lib/x86_64-linux-gnu/spa/support/libspa-support.so: cannot open shared object file: No such file or directory
Looks like we need a (runtime) dependency on pipewire. The package pipewire contains that file but on my system pipewire isn't installed yet, only libpipewire.
With pipewire installed xdg-desktop-portal-kde no longer crashes, but krfb still doesn't work and I get now: Using FrameBuffer: "pw" Initializing D-Bus connectivity with XDG Desktop Portal DBus session created: "/org/freedesktop/portal/desktop/request/1_154/krfb3821356350" Starting server. Listen port: 5900 Listen Address: "0.0.0.0" Password enabled: true Failed to start screencast: 2 Followed by a crash once we try to connect.
Error point in krfb: https://cgit.kde.org/krfb.git/tree/framebuffers/pipewire/pw_framebuffer.cpp#n385
and on xdg-desktop-portal-kde side: dp-kde-remotedesktop: CreateSession called with parameters: xdp-kde-remotedesktop: handle: "/org/freedesktop/portal/desktop/request/1_167/krfb1156724296" xdp-kde-remotedesktop: session_handle: "/org/freedesktop/portal/desktop/session/1_167/krfb287183258" xdp-kde-remotedesktop: app_id: "" xdp-kde-remotedesktop: options: QMap() xdp-kde-remotedesktop: SelectDevices called with parameters: xdp-kde-remotedesktop: handle: "/org/freedesktop/portal/desktop/request/1_167/krfb435177637" xdp-kde-remotedesktop: session_handle: "/org/freedesktop/portal/desktop/session/1_167/krfb287183258" xdp-kde-remotedesktop: app_id: "" xdp-kde-remotedesktop: options: QMap(("types", QVariant(uint, 7))) xdp-kde-screencast: SelectSource called with parameters: xdp-kde-screencast: handle: "/org/freedesktop/portal/desktop/request/1_167/krfb2905553260" xdp-kde-screencast: session_handle: "/org/freedesktop/portal/desktop/session/1_167/krfb287183258" xdp-kde-screencast: app_id: "" xdp-kde-screencast: options: QMap(("multiple", QVariant(bool, false))) xdp-kde-remotedesktop: Start called with parameters: xdp-kde-remotedesktop: handle: "/org/freedesktop/portal/desktop/request/1_167/krfb649013723" xdp-kde-remotedesktop: session_handle: "/org/freedesktop/portal/desktop/session/1_167/krfb287183258" xdp-kde-remotedesktop: app_id: "" xdp-kde-remotedesktop: parent_window: "" xdp-kde-remotedesktop: options: QMap() [New Thread 0x7fffd88cd700 (LWP 31160)] [New Thread 0x7fffc6087700 (LWP 31161)] xdp-kde-screencast-stream: Remote state: connecting xdp-kde-screencast-stream: Remote error: connect failed No such file or directory [New Thread 0x7fffc545a700 (LWP 31162)] xdp-kde-screencast-stream: Remote state: unconnected [Thread 0x7fffc545a700 (LWP 31162) exited] [Thread 0x7fffc6087700 (LWP 31161) exited] xdp-kde-session: "org.freedesktop.impl.portal.Session" xdp-kde-session: "Close" xdp-kde-session: "/org/freedesktop/portal/desktop/session/1_167/krfb287183258"
I got it working: one just needs to start pipewire
hoorah well done. I don't know anything about Pipewire. The package has a systemd user job so maybe it just needed logged out and in again.
I added pipewire as a runtime dependency of xdg-desktop-portal-kde
Yeah pipewire should socket-activate, but it doesn't - at least on my system. I tried system restart already. That might be a local issue or a general issue in the upstream package. It's a new technology after all.
Screenshot of krdc to krfb on Wayland: https://share.kde.org/s/cAXwLerPZcmy92j Setting to fixed as packaging wise everything gets properly installed. Verified in my virtual machine. Unfortunately also in the VM pipewire did not autostart, but that's probably a topic for a different bug and maybe resolves itself once Neon updates to Ubuntu 20.04.