Skip to content

Cog keeps crashing #758

@ragunaru

Description

@ragunaru

Hello, folks! I'm very much a novice to Linux, WebKit and Cog.

I've been trying to get a simple Buildroot setup working with Cog using DRM and while I've cleared a fair few hurdles to even get this far, Cog simply refuses to render anything and keeps crashing:

(cog:347): Cog-Core-CRITICAL **: 18:09:11.062: The renderer process crashed, exiting...

I don't know what else to do and I'm unsure how to debug this. I'm looking for any hints or pointers that can set me on the right path.

My setup:

  • Raspberry Pi 5 with 8GB RAM
  • OS: Buildroot (2025.05)
  • Cog (0.18.4)
  • WPE WebKit (2.44.4)

I believe I have all the require packages enabled (showing just the relevant ones) in my defconfig

# WPE Webkit and cog
BR2_PACKAGE_WPEWEBKIT=y
BR2_PACKAGE_COG=y
BR2_PACKAGE_WPEBACKEND_FDO=y
BR2_PACKAGE_COG_PLATFORM_DRM=y
BR2_PACKAGE_COG_PLATFORM_FDO=n
BR2_PACKAGE_EUDEV=y
# glib might need for mime types?
# and won't load local pages without? dunno...
BR2_PACKAGE_SHARED_MIME_INFO=y

# A lack of fonts can cause webkit crashes? Bruh...
BR2_PACKAGE_BITSTREAM_VERA=y

# Serving built react/vite app locally
BR2_PACKAGE_LIGHTTPD=y

# GPU related
BR2_PACKAGE_MESA3D=y
BR2_PACKAGE_MESA3D_GALLIUM_DRIVER_V3D=y
BR2_PACKAGE_MESA3D_OPENGL_ES=y

In my cog-env.sh file I do the following:

#!/bin/sh

# Set base cog parameters. I flippin hope these work.
export COG_PLATFORM_NAME=drm
export EGL_PLATFORM=drm # need to explicitly tell EGL to use drm? dunno, undocumented...

# Create runtime directory with proper permissions
export XDG_RUNTIME_DIR=/run/user/0
mkdir -p "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"

# Ensure proper device permissions
chmod 666 /dev/dri/card0 2>/dev/null || true
chmod 666 /dev/dri/renderD128 2>/dev/null || true
chmod 666 /dev/input/* 2>/dev/null || true

I've also had to set up these symlinks in my post-build.sh cause apparently webkit/cog (I don't remember) couldn't find the correct things:

# Create OpenGL symlinks for compatibility
echo "Creating OpenGL compatibility symlinks..."

# For libGL.so.1 (Using GLESv2 as the implementation)
if [ -f "${TARGET_DIR}/usr/lib/libGLESv2.so" ] && [ ! -f "${TARGET_DIR}/usr/lib/libGL.so.1" ]; then
    ln -sf libGLESv2.so ${TARGET_DIR}/usr/lib/libGL.so.1
    ln -sf libGLESv2.so ${TARGET_DIR}/usr/lib/libGL.so
    echo "Created libGL.so.1 -> libGLESv2.so symlink"
fi

# For libOpenGL.so.0 (Using EGL as the implementation)
if [ -f "${TARGET_DIR}/usr/lib/libEGL.so" ] && [ ! -f "${TARGET_DIR}/usr/lib/libOpenGL.so.0" ]; then
    ln -sf libEGL.so ${TARGET_DIR}/usr/lib/libOpenGL.so.0
    ln -sf libEGL.so ${TARGET_DIR}/usr/lib/libOpenGL.so
    echo "Created libOpenGL.so.0 -> libEGL.so symlink"
fi

# Make sure cog can run
chmod +x "${TARGET_DIR}/etc/profile.d/cog-env.sh"

Lastly, my config.txt has the correct overlay set for the Pi and some screen related flags (a Waveshare HDMI touch display):

# GPU memory allocation - important for WPE/COG
gpu_mem_1024

# Enable VC4/V3D driver with full KMS
dtoverlay=vc4-kms-v3d
max_framebuffers=2

# Force HDMI mode even if no HDMI monitor detected
hdmi_force_hotplug=1

# Setting for display
hdmi_group=2
hdmi_mode=87
hdmi_cvt 1280 800 60 6 0 0 0
hdmi_drive=1

I then try to run Cog in the terminal like such (I've added url related flags based on this issue):

G_MESSAGES_DEBUG=all cog --platform=drm --platform-params="renderer=gles" --webprocess-failure=exit --enable-write-console-messages-to-stdout=true --allow-file-access-from-file-urls=true --allow-universal-access-from-file-urls=true file:///www/index.html

I've ran out of ideas. It doesn't matter whether it's a local file or a URL, it simply keeps crashing. I don't know if there is some requirement I've yet to meet or there's a missing package. No clue. I wish there was documentation for this. If there is, can someone please point me to it?

Any help super appreciated. I've been at it for days now, lol...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions