cog icon indicating copy to clipboard operation
cog copied to clipboard

fdo backend on latest buildroot is not supported

Open coop opened this issue 3 years ago • 2 comments

Hi,

I am trying to get a minimal cog + wpe and friends build for buildroot 2022.05 on a raspberry pi4 (64bit) but keep running into issues specifying the fdo backend:

# G_MESSAGES_DEBUG=all cog -P fdo http://lists.busybox.net/mailman/listinfo
(cog:811): Cog-Core-DEBUG: 07:41:04.324: ensure_extension_points: Extension points registered.
(cog:811): Cog-Core-DEBUG: 07:41:04.325: cog_modules_add_directory: Scanning '/usr/lib/cog/modules'
Cog-INFO: 07:41:04.332: com.igalia.Cog.Platform:
Cog-INFO: 07:41:04.332:   wl - 500/CogWlPlatform
Cog-INFO: 07:41:04.332:   headless - 100/CogHeadlessPlatform
(cog:811): Cog-DEBUG: 07:41:04.355: platform_setup: Platform name: fdo

(cog:811): Cog-Core-WARNING **: 07:41:04.356: Platform module name 'fdo' is deprecated, please use 'wl' instead.

(cog:811): Cog-Core-WARNING **: 07:41:04.360: cog_modules_get_preferred: preferred module 'wl' not supported

(cog:811): Cog-WARNING **: 07:41:04.360: Cannot create platform: Could not find an usable platform module
(cog:811): Cog-DEBUG: 07:41:04.361: Instantiating default WPE backend as fall-back.
wpe: could not load the impl library. Is there any backend installed?: libWPEBackend-default.so: cannot open shared object file: No such file or directory
Aborted
# (process:817): GLib-GIO-DEBUG: 07:41:04.464: Failed to initialize portal (GNetworkMonitorPortal) for gio-network-monitor: Not using portals
(process:817): GLib-GIO-DEBUG: 07:41:04.477: Failed to initialize networkmanager (GNetworkMonitorNM) for gio-network-monitor: NetworkManager not running
(process:817): GLib-GIO-DEBUG: 07:41:04.478: _g_io_module_get_default: Found default implementation netlink (GNetworkMonitorNetlink) for ?gio-network-monitor?

wpe seems to be complaining about a missing file: Is there any backend installed?: libWPEBackend-default.so: cannot open shared object file: No such file or directory so after symlinking the file I re-ran the command with basically the same error:

# cd /usr/lib
# ln -snf libWPEBackend-fdo-1.0.so libWPEBackend-default.so
# G_MESSAGES_DEBUG=all cog -P fdo http://lists.busybox.net/mailman/listinfo
(cog:826): Cog-Core-DEBUG: 07:44:14.561: ensure_extension_points: Extension points registered.
(cog:826): Cog-Core-DEBUG: 07:44:14.562: cog_modules_add_directory: Scanning '/usr/lib/cog/modules'
Cog-INFO: 07:44:14.569: com.igalia.Cog.Platform:
Cog-INFO: 07:44:14.569:   wl - 500/CogWlPlatform
Cog-INFO: 07:44:14.569:   headless - 100/CogHeadlessPlatform
(cog:826): Cog-DEBUG: 07:44:14.593: platform_setup: Platform name: fdo

(cog:826): Cog-Core-WARNING **: 07:44:14.593: Platform module name 'fdo' is deprecated, please use 'wl' instead.

(cog:826): Cog-Core-WARNING **: 07:44:14.598: cog_modules_get_preferred: preferred module 'wl' not supported

(cog:826): Cog-WARNING **: 07:44:14.598: Cannot create platform: Could not find an usable platform module
(cog:826): Cog-DEBUG: 07:44:14.598: Instantiating default WPE backend as fall-back.

** (cog:826): CRITICAL **: 07:44:14.599: WebKitWebViewBackend* webkit_web_view_backend_new(wpe_view_backend*, GDestroyNotify, gpointer): assertion 'backend' failed

(cog:826): Cog-ERROR **: 07:44:14.599: Could not instantiate any WPE backend.
Trace/breakpoint trap
# (process:832): GLib-GIO-DEBUG: 07:44:14.703: Failed to initialize portal (GNetworkMonitorPortal) for gio-network-monitor: Not using portals
(process:832): GLib-GIO-DEBUG: 07:44:14.716: Failed to initialize networkmanager (GNetworkMonitorNM) for gio-network-monitor: NetworkManager not running
(process:832): GLib-GIO-DEBUG: 07:44:14.717: _g_io_module_get_default: Found default implementation netlink (GNetworkMonitorNetlink) for ?gio-network-monitor?

Surprisingly if I don’t pass a backend cog will say it has started correctly but nothing is displayed on the attached monitor:

# G_MESSAGES_DEBUG=all cog http://lists.busybox.net/mailman/listinfo
(cog:838): Cog-Core-DEBUG: 07:45:49.225: ensure_extension_points: Extension points registered.
(cog:838): Cog-Core-DEBUG: 07:45:49.226: cog_modules_add_directory: Scanning '/usr/lib/cog/modules'
Cog-INFO: 07:45:49.233: com.igalia.Cog.Platform:
Cog-INFO: 07:45:49.233:   wl - 500/CogWlPlatform
Cog-INFO: 07:45:49.233:   headless - 100/CogHeadlessPlatform
(cog:838): Cog-DEBUG: 07:45:49.257: platform_setup: Platform name: (null)
(cog:838): Cog-DEBUG: 07:45:49.265: platform_setup: Selected CogHeadlessPlatform @ 0x55892a7ac0

(cog:838): GLib-GIO-WARNING **: 07:45:49.276: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal.  It should do one of these.
(process:844): GLib-GIO-DEBUG: 07:45:49.372: Failed to initialize portal (GNetworkMonitorPortal) for gio-network-monitor: Not using portals
(process:844): GLib-GIO-DEBUG: 07:45:49.387: Failed to initialize networkmanager (GNetworkMonitorNM) for gio-network-monitor: NetworkManager not running
(process:844): GLib-GIO-DEBUG: 07:45:49.388: _g_io_module_get_default: Found default implementation netlink (GNetworkMonitorNetlink) for ?gio-network-monitor?
(process:844): GLib-GIO-DEBUG: 07:45:49.392: _g_io_module_get_default: Found default implementation local (GLocalVfs) for ?gio-vfs?
(WPEWebProcess:845): GLib-GIO-DEBUG: 07:45:49.457: Failed to initialize portal (GPowerProfileMonitorPortal) for gio-power-profile-monitor: Not using portals
(WPEWebProcess:845): GLib-GIO-DEBUG: 07:45:49.460: _g_io_module_get_default: Found default implementation dbus (GPowerProfileMonitorDBus) for ?gio-power-profile-monitor?
Cog-Core-Message: 07:45:51.829: <http://lists.busybox.net/mailman/listinfo> Load started.
(process:844): GLib-GIO-DEBUG: 07:45:51.832: _g_io_module_get_default: Found default implementation dummy (GDummyProxyResolver) for ?gio-proxy-resolver?
(process:844): GLib-GIO-DEBUG: 07:45:51.845: _g_io_module_get_default: Found default implementation openssl (GTlsBackendOpenssl) for ?gio-tls-backend?
(process:844): GLib-GIO-DEBUG: 07:45:51.847: GSocketClient: Starting new address enumeration
(process:844): GLib-GIO-DEBUG: 07:45:52.077: GSocketClient: Address enumeration succeeded
(process:844): GLib-GIO-DEBUG: 07:45:52.078: GSocketClient: Starting TCP connection attempt
(process:844): GLib-GIO-DEBUG: 07:45:52.264: GSocketClient: TCP connection successful
(process:844): GLib-GIO-DEBUG: 07:45:52.264: GSocketClient: Starting application layer connection
(process:844): GLib-GIO-DEBUG: 07:45:52.265: GSocketClient: Connection successful!
Cog-Core-Message: 07:45:53.750: <http://lists.busybox.net/mailman/listinfo> Loading...
(process:844): GLib-GIO-DEBUG: 07:45:53.760: GSocketClient: Starting new address enumeration
(process:844): GLib-GIO-DEBUG: 07:45:53.763: GSocketClient: Starting new address enumeration
(process:844): GLib-GIO-DEBUG: 07:45:53.764: GSocketClient: Address enumeration succeeded
(process:844): GLib-GIO-DEBUG: 07:45:53.765: GSocketClient: Starting TCP connection attempt
(process:844): GLib-GIO-DEBUG: 07:45:53.766: GSocketClient: Address enumeration succeeded
(process:844): GLib-GIO-DEBUG: 07:45:53.767: GSocketClient: Starting TCP connection attempt
(process:844): GLib-GIO-DEBUG: 07:45:53.958: GSocketClient: TCP connection successful
(process:844): GLib-GIO-DEBUG: 07:45:53.959: GSocketClient: Starting application layer connection
(process:844): GLib-GIO-DEBUG: 07:45:53.960: GSocketClient: Connection successful!
(process:844): GLib-GIO-DEBUG: 07:45:53.961: GSocketClient: TCP connection successful
(process:844): GLib-GIO-DEBUG: 07:45:53.962: GSocketClient: Starting application layer connection
(process:844): GLib-GIO-DEBUG: 07:45:53.962: GSocketClient: Connection successful!
Cog-Core-Message: 07:45:54.171: <http://lists.busybox.net/mailman/listinfo> Loaded successfully.

I have tried all three of these command with and without weston running and it doesn’t change the outcome:

# mkdir /tmp/weston
# chmod 700 /tmp/weston
# export XDG_RUNTIME_DIR=/tmp/weston
# weston --tty 1 &

(Running weston does change the monitor’s display from a buildroot shell to a window, cog just never seems to take over)

I have tried to make as minimal changes to the standard rpi4 defconfig as possible, here is the diff (edit make savedefconfig didn't work as expected so I'll list the packages I added):

  • cog (both fdo and drm)
  • weston
  • all the fonts
  • wpewebkit
  • dropbear
  • BR2_PACKAGE_MESA3D=y
  • BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_SWRAST=y
  • BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D=y
  • BR2_PACKAGE_MESA3D_OPENGL_ES=y
  • BR2_PACKAGE_WESTON=y

I have found 2 other versions of buildroot configs (https://github.com/Igalia/buildroot-wpe and https://github.com/WebPlatformForEmbedded/buildroot) that I’m guessing existed before wpe and friends were upstreamed but it’s kind of hard to tell because the last repo is still active… I’ve tried looking for inspiration in these repos but they’ve diverged so much I found it difficult.

I’m sure there is something basic and or obvious that I’ve overlooked - is there anything you can point out that I’m doing wrong?

Thanks!

coop avatar Jul 05 '22 08:07 coop

The foo backend was renamed to wl. I think upstream buildroot has proper WPE recipes nowadays. The repos you found are one outdated overlay and one downstream project for building downstream versions of WPE. I'll let @aperezdc chime in :)

philn avatar Jul 06 '22 17:07 philn

Thanks for following up @philn - I just want to clarify some points:

I think upstream buildroot has proper WPE recipes nowadays. The repos you found are one outdated overlay and one downstream project for building downstream versions of WPE.

As I mentioned in my description I'm trying to build using upstream buildroot 2022.05 which has the latest version of wpe and friends - I linked the other repos just as a reference.

The foo backend was renamed to wl.

I saw this in the 0.11.1 release notes, -P fdo just emits a warning - I am referencing fdo because that seems to be its most common name and the only reference I can see to wl is in the release notes. As a side note, if I pass -P wl I get the exact same error minus the deprecation notice.

Also, I just wanted to follow up with some investigation I was doing, the important error is:

(cog:826): Cog-Core-WARNING **: 07:44:14.598: cog_modules_get_preferred: preferred module 'wl' not supported

(cog:826): Cog-WARNING **: 07:44:14.598: Cannot create platform: Could not find an usable platform module

Which I'm guessing is saying "your setup does not support the waylaid module". I found the warning in the codebase and I'm guessing can_use_extension is false. I don't know enough about these libraries to debug further but I'm happy to help out if you can point me in the right direction.

coop avatar Jul 06 '22 22:07 coop

@coop have you been able to solve this problem, please? My device behaves very same as yours did. I haven't found out any solution yet.

setup:

  • buildroot 2022.11 on custom stm32mp1 device (vivante GPU).
  • cog 0.14.1 (also tried version 0.16.1, same behavior)
  • wpewebkit 2.38.0
  • libwpe 1.12.3
# G_MESSAGES_DEBUG=all LIBWPE_DEBUG=all LIBGL_DEBUG=verbose cog -P wl
(process:1012): Cog-Core-DEBUG: 02:09:22.386: ensure_extension_points: Extension points registered.
(process:1012): Cog-Core-DEBUG: 02:09:22.387: cog_modules_add_directory: Scanning '/usr/lib/cog/modules'
Cog-INFO: 02:09:22.417: com.igalia.Cog.Platform:
Cog-INFO: 02:09:22.417:   wl - 500/CogWlPlatform
Cog-INFO: 02:09:22.418:   drm - 200/CogDrmPlatform
Cog-INFO: 02:09:22.418:   headless - 100/CogHeadlessPlatform
(cog:1012): Cog-DEBUG: 02:09:22.441: platform_setup: Platform name: wl

(cog:1012): Cog-Core-WARNING **: 02:09:22.450: cog_modules_get_preferred: preferred module 'wl' not supported

(cog:1012): Cog-WARNING **: 02:09:22.450: Cannot create platform: Could not find an usable platform module
(cog:1012): Cog-DEBUG: 02:09:22.451: Instantiating default WPE backend as fall-back.

** (cog:1012): CRITICAL **: 02:09:22.452: WebKitWebViewBackend* webkit_web_view_backend_new(wpe_view_backend*, GDestroyNotify, gpointer): assertion 'backend' failed

(cog:1012): Cog-ERROR **: 02:09:22.453: Could not instantiate any WPE backend.
Trace/breakpoint trap
# ls -l /usr/lib/cog/modules/
total 136
-rwxr-xr-x    1 root     root         58764 Feb 27  2023 libcogplatform-drm.so
-rwxr-xr-x    1 root     root          9448 Feb 27  2023 libcogplatform-headless.so
-rwxr-xr-x    1 root     root         63872 Feb 27  2023 libcogplatform-wl.so

sedlalu2 avatar Feb 27 '23 14:02 sedlalu2

You run this inside a Wayland compositor, right?

philn avatar Feb 27 '23 15:02 philn

@philn I hope so. I am starting weston with this command:

export XDG_RUNTIME_DIR=/tmp/weston-runtime-dir/
weston-launch -u root -t /dev/tty2 -- --shell=kiosk-shell.so -B drm-backend.so --log="/var/log/weston" &

Everything works good I suppose. Logging file shows that weston has started correctly.

sedlalu2 avatar Feb 27 '23 15:02 sedlalu2

The weston demos work too?

philn avatar Feb 27 '23 15:02 philn

@sedlalu2 only the fdo (wayland) backend is supported on rpi4 - I got this error when I also included the DRM backend in the build options.

Regarding your command, I was able to get away with something like:

$ mkdir /tmp/xdg # might also need to set permissions
$ XDG_RUNTIME_DIR=/tmp/xdg weston --tty 1 &
$ XDG_RUNTIME_DIR =/tmp/xdg cog --platform=wl https://google.com &

coop avatar Feb 27 '23 21:02 coop

I finally managed to start cog correctly with these commands:

$ export XDG_RUNTIME_DIR=/tmp/weston-runtime-dir/
$ export WAYLAND_DISPLAY=wayland-1

$ weston-launch -u root -t /dev/tty2 -- -B drm-backend.so --log="/var/log/weston" &
$ cog --platform=wl

I had to set WAYLAND_DISPLAY correctly, then I finally managed to see cog running in weston. Also cog starts only when weston is using desktop shell. It is still not working via kiosk shell. Also mesa started to print errors:

MESA: error: etna_cmd_stream_flush:238: submit failed: -28 (No space left on device)

According to mesa repo this problem seems to be related to incompatible kernel and mesa version: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7153

I'll try to downgrade buildroot to version 2022.05 which uses older mesa library. Anyway, this problem is no longer cog related I suppose. Thanks guys for help :)

sedlalu2 avatar Feb 28 '23 08:02 sedlalu2

Given that questions about how to run Cog with the Wayland plug-in pop now and then, I have taken some time to write down an overview of the plug-in, see https://github.com/Igalia/cog/pull/540 for details. It also indicates that WAYLAND_DISPLAY and XDG_RUNTIME_DIR are needed, and how to define them. Hopefully that will be handy in the future. Once the PR lands the documentation will appear at https://igalia.github.io/cog/platform-wl.html 📜

I think we can consider this issue closed 😉

aperezdc avatar Feb 28 '23 12:02 aperezdc

@sedlalu2: Can you please list the buildroot packages you have enabled for your setup or can you provide a corresponding defconfig?

T94T avatar Feb 28 '23 19:02 T94T

@aperezdc that doc is great - thanks.

coop avatar Feb 28 '23 21:02 coop