Skip to content

fix(appimage): bundle the X11 libraries winit opens at runtime - #144

Merged
astrovm merged 7 commits into
mainfrom
fix/appimage-runtime-libs
Nov 21, 2026
Merged

astrovm merged 7 commits into
mainfrom
fix/appimage-runtime-libs

Conversation

@astrovm

@astrovm astrovm commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Problem

The AppImage catalog test (AppImage/appimage.github.io PR #12309) opens the app on Ubuntu 22.04 with only Xvfb. The 1.3.5 AppImage starts, but winit fails before the window opens:

Library libxkbcommon-x11.so could not be loaded.
Failed to load one of xlib's shared libraries

winit opens the X11 libraries at runtime with dlopen (x11-dl and xkbcommon-dl). linuxdeploy reads only the ELF dependencies, so it did not bundle them. The build system had them, so the build looked fine.

Changes

  1. build-aux/appimage/build-appimage.sh: pass --library to linuxdeploy for libxkbcommon.so.0, libxkbcommon-x11.so.0, libXcursor.so.1 and libXi.so.6. The script fails if one of them is missing on the build system. linuxdeploy adds what they need in turn (libxcb-xkb, libXext, libXfixes, libXrender).
    a. libGL, libEGL, libX11, libX11-xcb, libxcb and libwayland-client stay on the host. They are on the AppImage exclude list, because they must match the host graphics drivers and display server.
  2. build-aux/appimage/build-container.sh: install libxkbcommon-x11-0, libxcursor1 and libxi6 in the Ubuntu 22.04 build container.
  3. build-aux/appimage/test-window.sh (new): run the AppImage in a minimal ubuntu:22.04 container with only Xvfb and Mesa, and pass when the "Adventure Mods" window is mapped (IsViewable in xwininfo) within 60 seconds and the app still runs 3 seconds later. It prints the app log on failure, exits 2 when the AppImage path is wrong, and uses podman or docker.
  4. .github/workflows/ci.yml: the AppImage job runs test-window.sh in place of the old --version check. --version did not catch this, because it never opens a window. The step has a 10-minute timeout.
  5. Version 1.3.6 in Cargo.toml, Cargo.lock and the metainfo release notes.
  6. fuzz/Cargo.lock: update the stale adventure-mods version (1.3.4) to 1.3.6.
  7. New build-aux/appimage/catalog-test.sh and CI job appimage-catalog: on a GitHub ubuntu-22.04 runner, it runs the catalog's own code/worker.sh (pinned commit) on the x86_64 AppImage, set up as the catalog's test.yml does: its packages, dupervisor, firejail, Xvfb at 800x600, the screenshot and its checks. A local Node server gives the AppImage to the worker under its real file name. The job fails when the catalog test fails or when the catalog would not mark the screenshot as good, and it uploads the log, findings and screenshot. CI / Required and the release job need it.
    a. test-window.sh stays: it is the quick check that runs locally in a rootless container. The catalog test cannot, because firejail loop-mounts the AppImage as root.
  8. build-aux/appimage/build-appimage.sh: renders a 256x256 PNG icon with rsvg-convert and points .DirIcon at it before linuxdeploy runs (linuxdeploy keeps an existing .DirIcon). The catalog warned "Icon is not in PNG format". build-container.sh installs librsvg2-bin.
  9. .github/workflows/ci.yml: the catalog result artifact is now appimage-catalog-test. Its old name, AdventureMods-AppImage-catalog-test, matched the AdventureMods-AppImage-* pattern of the release job. Its 4 files would then break the release job's check for exactly 8 files on the next tag.
  10. catalog-test.sh:
    a. It fails on any catalog warning or error except the two under Not changed. Before, it checked only the screenshot remarks, so the icon warning could come back unnoticed. Measured on the saved results: the cd827ec result fails on the icon warning, and the b52a4b5 result passes.
    b. It runs only on GitHub Actions, or with ALLOW_HOST_CHANGES=1. The catalog's worker copies firejail into /lib, /usr and /etc as root. On mr, it now stops with exit 2 and a message.
    c. It removes its work folder with sudo at exit.
    d. It stops when the dummy sound card setup fails, as the catalog workflow does. The old comment said the opposite.

Not changed

  1. The catalog warns "No appdata file present", because its lint looks only for *appdata.xml. The AppImage ships io.github.astrovm.AdventureMods.metainfo.xml. Renaming it would make the catalog run its old appstreamcli validate-tree, which fails on the current file ("Invalid property for 'url' tag: vcs-browser", exit 3, measured). The catalog still reads the license and screenshots from the .metainfo.xml file.
  2. The catalog warns "The window is mostly dark". That is the app's blue design, and the catalog ignores this warning for its screenshot-ok label.

Measurements

AppImage Minimal Ubuntu 22.04 + Xvfb Fedora 43 + Xvfb
v1.3.5 No window: "Failed to load one of xlib's shared libraries" not tested
v1.3.6 (this PR) "The window opened." Window opened

The 1.3.6 build still needs glibc 2.35 at most.

Catalog test on CI (cd827ec)

The first run of the real catalog test opened the window and took a screenshot of the app. It then failed only because the script did not install dupervisor, which the catalog workflow installs. That is fixed.

Done when

  • The 1.3.6 AppImage opens its window in a minimal Ubuntu 22.04 with Xvfb (local test-window.sh, exit 0).
  • The 1.3.5 AppImage fails the same test (exit 1), so the test catches the bug.
  • The AppImage still opens on a newer distro (Fedora 43).
  • CI passes on f7a8627, including the window step and the catalog test. The run has only one artifact that matches the release pattern AdventureMods-AppImage-*: AdventureMods-AppImage-x86_64.
  • The appimage-catalog job passes on f7a8627: "SUCCESS", a screenshot of the app, X-AppImage-Glibc-Required=GLIBC_2.35, and only the two warnings under Not changed.
  • Agent review of the window fix: no blocking bug. Fixes listed under Review.
  • Agent review of the catalog test and the PNG icon. Fixes listed under Review.

Trade-off

The bundled libxkbcommon, libXcursor and libXi (Ubuntu 22.04 builds) now replace the host copies on every distro. libxkbcommon finds the xkb data through the FHS path /usr/share/X11/xkb. This is normal for AppImages. Fedora 43 works. Hosts without FHS paths, such as NixOS, run AppImages through appimage-run, which gives them an FHS environment.

Review

A Sonnet agent reviewed the full diff. It found no blocking bug. Every library name in the binary is now bundled or on the exclude list. The release checks (tag, Cargo.toml, metainfo) agree on 1.3.6.

  1. Fixed: the test passed as soon as the window existed, before it was mapped or drew a frame. It now requires IsViewable and a running app 3 seconds later.
  2. Fixed: a wrong AppImage path gave a confusing error. It now exits 2 with a clear message.
  3. Fixed: a grep -q pipe could fail with SIGPIPE under pipefail. The output is now captured first.
  4. Fixed: the CI step had no timeout. It now has timeout-minutes: 10.
  5. Not changed: bundled libraries replace the host copies. See Trade-off.
  6. Not changed: the test installs Mesa (libGL, libEGL), which the catalog runner also has. These libraries are on the exclude list, so the AppImage must not bring them.
  7. Not changed: kill stops only the AppImage runtime process. The container is --rm, so nothing stays.

The fixes change only the test script. I checked them by measurement, not by a second agent review: the agent quota had no room. After the fixes, 1.3.6 passes (exit 0) and 1.3.5 fails with the xlib error (exit 1).

Second review: the catalog test and the PNG icon

A Sonnet agent reviewed the changes after 4b0b654, together with PkgDeck PR #425.

  1. Fixed (high): the release job would download the catalog result with the AppImages and fail its 8-file check on the next tag. See change 9. PR CI did not catch it, because the release job runs only on tags.
  2. Fixed: nothing failed when the icon warning came back. See change 10a.
  3. Fixed: the script changed the host as root when run outside CI. See change 10b.
  4. Fixed: the work folder stayed after the test. See change 10c.
  5. Fixed: the sound card comment was wrong. See change 10d.
  6. Not changed: the release job needs the catalog test, and the test downloads from Alpine and GitHub. A network failure there blocks a tag until someone runs the job again. This is on purpose: a release must pass the catalog's test.
  7. Not changed: linuxdeploy also bundles libXau, libXdmcp, libbsd and libmd, which only the system's libX11 and libxcb need. These libraries have stable interfaces, and no host is known where the Ubuntu 22.04 copies break.

The fixes change only CI and the test script, not the AppImage. Claude's quota had no room for a second review, so I checked them by measurement, as listed in change 10.

@astrovm
astrovm marked this pull request as draft November 21, 2026 11:03
@astrovm
astrovm marked this pull request as ready for review November 21, 2026 11:16
@astrovm
astrovm marked this pull request as draft November 21, 2026 11:43
@astrovm
astrovm marked this pull request as ready for review November 21, 2026 12:18
@astrovm
astrovm merged commit 194753d into main Nov 21, 2026
21 checks passed
@astrovm
astrovm deleted the fix/appimage-runtime-libs branch November 21, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant