I’m trying to get a Rust app which uses EGL to spawn a window on Wayland. I want to be able to automate my workflow so the templates provided by the VS Code IDE extension aren’t particularly useful.
So, I’m trying to use the Rust cross
build tool which uses docker and a correctly cross compiling toolchain to cross compile, like this: cross build --target aarch64-unknown-linux-gnu
I’ve added some extra arm64 packages to the build there:
[target.aarch64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update && apt-get --assume-yes install libxkbcommon0:$CROSS_DEB_ARCH libwayland-dev:$CROSS_DEB_ARCH libudev-dev:$CROSS_DEB_ARCH"
]
The build seems to work fine, and I’ve used binaries without video support before from this cross compiling toolchain.
I then have a Dockerfile which puts this cross compiled app in the wayland-base-imx8:stable-rc image:
FROM --platform=linux/arm64 torizon/wayland-base-imx8:stable-rc
COPY ./target/aarch64-unknown-linux-gnu/debug/my_app /home/torizon/my_app
I then have a docker-compose.yml file which looks like this:
version: "3.9"
services:
weston:
image: torizon/weston-imx8:4
container_name: weston
network_mode: host
cap_add:
- SYS_TTY_CONFIG
volumes:
- /dev:/dev
- /tmp:/tmp
- /run/udev:/run/udev
device_cgroup_rules:
- "c 4:* rmw"
- "c 253:* rmw"
- "c 13:* rmw"
- "c 226:* rmw"
- "c 10:223 rmw"
- "c 199:0 rmw"
command: ["--developer"]
restart: unless-stopped
wayland-app:
image: my_image
container_name: wayland-app
cap_add:
- SYS_TTY_CONFIG
environment:
ACCEPT_FSL_EULA: "1"
volumes:
- /dev/dri:/dev/dri
- /dev/galcore:/dev/galcore
- /tmp:/tmp
device_cgroup_rules:
- "c 199:* rmw"
- "c 226:* rmw"
entrypoint: ["/bin/bash"]
depends_on: [weston]
command: ["-c", "sleep 2 && /home/torizon/my_app"]
restart: no
This seems to launch just fine, I don’t see any errors, it detects the outputs correctly, but when the app goes to launch, it doesn’t find a default display:
docker compose up
WARN[0000] /home/torizon/docker-compose.yml: `version` is obsolete
[+] Running 1/2
✔ Container weston Created 0.0s
⠙ Container wayland-app Recreated 0.1s
Attaching to wayland-app, weston
weston | Switching VT tty1 to text mode if currently in graphics mode
weston | Switching to VT 7
weston | SoC is: 'i.MX8MP'
weston | SoC has GPU: true
weston | SoC has DPU: false
weston | g2d implementation: viv
...
weston | [20:44:05.691] using /dev/dri/card1
...
weston | [20:44:06.319] Output HDMI-A-1 (crtc 33) video modes:
weston | 1280x720@60.0, preferred, current, 74.2 MHz
...
wayland-app | 2024-12-12T20:49:43.745871Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 12 Debian GNU/Linux", kernel: "6.6.23-7.0.0-g558ba3740880", cpu: "Cortex-A53", core_count: "4", memory: "7.8 GiB" }
wayland-app | EGL: Warning: No default display support on wayland
wayland-app | thread 'main' panicked at /cargo/registry/src/index.crates.io-6f17d22bba15001f/khronos-egl-6.0.0/src/lib.rs:1779:26:
wayland-app | called `Option::unwrap()` on a `None` value
wayland-app | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
wayland-app exited with code 101
It’s like the EGL libraries are broken. What do I need to do to fix this?