Skip to content

Linux AppImage: GTK3 is broken in the bundle — any file dialog aborts the whole process #805

Description

@jordan-bravo

I ran the AppImage of v3.3.4 on NixOS (with appimage-run) and Maple started up but when I clicked on "Select a folder", the app crashes and exits. Using a LLM to troubleshoot, I was able to get it running.

(The details below were written with an LLM)

Summary

In Agent Mode, clicking Select a folder terminates the app immediately (no error dialog, process exits). tauri-plugin-dialogrfd 0.16 uses the gtk3 backend (gtk-sys in Cargo.lock, no ashpd), so this is an in-process GtkFileChooser, not an XDG portal.

Two independent defects each abort the process. Fixing one exposes the other:

environment result
as shipped post_process_ui: assertion failed: (cells)
stock libgtk-3.so.0 only Settings schema 'org.gtk.Settings.FileChooser' is not installed
stock lib + GTK3 schemas widget constructs, no abort

Observed on 3.3.4 (AppImage), NixOS 26.11 / GNOME 50.

Defect 1 — bundled libgtk-3.so.0 cannot load its own GResources

Unable to load resource for composite template for type 'GtkFileChooserWidget':
  The resource at "/org/gtk/libgtk/ui/gtkfilechooserwidget.ui" does not exist
... ~100 × gtk_widget_class_bind_template_child_full: 'template != NULL' failed
Gtk:ERROR:../gtk/gtkfilechooserwidget.c:8779:post_process_ui: assertion failed: (cells)

The bundled library differs from stock gtk+3-3.24.52 (10,589,488 vs 8,819,552 bytes) and has been ELF-rewritten by the packaging pipeline: RUNPATH [$ORIGIN:$ORIGIN/..:…] added, and 5 PT_LOAD segments vs 4. Stock builds the same widget with no abort; shadowing the bundled copy with stock is sufficient to clear this defect. I did not isolate which pipeline step breaks it — repair_linux_appdir_runtime_closure (scripts/ci/_common.sh:3364) runs patchelf --replace-needed over every ELF in the AppDir, and sanitize_linux_appdir_library_rpaths rewrites RUNPATHs, so both touch this file.

This is not specific to the file chooser: it breaks every GTK composite-template widget. A cheap canary is present at startup in normal runs, before any dialog is opened:

Gtk-CRITICAL **: _gtk_css_provider_load_named: assertion '!g_str_equal (name, DEFAULT_THEME_NAME)' failed

That line disappears once a working GTK3 is used.

Defect 2 — no GTK3 GSettings schemas are bundled

$APPDIR/usr/share/glib-2.0/schemas/ contains only gschema.dtd — no gschemas.compiled, no schema XML. AppRun and apprun-hooks/linuxdeploy-plugin-gtk.sh both point GSETTINGS_SCHEMA_DIR at that empty directory. GTK3's file chooser then calls g_settings_new("org.gtk.Settings.FileChooser"), which is a g_error() abort when the schema is absent.

Hosts running a GTK4-era desktop (GNOME 50 here) do not provide GTK3 schemas either, so there is nothing to fall back to.

Reproduce

// gtkprobe.c — cc -o gtkprobe gtkprobe.c -ldl
#include <dlfcn.h>
#include <stdio.h>
int main(void){
  void *h = dlopen("libgtk-3.so.0", RTLD_NOW|RTLD_GLOBAL);
  int  (*init_check)(int*,char***) = dlsym(h,"gtk_init_check");
  void*(*fc_new)(int)              = dlsym(h,"gtk_file_chooser_widget_new");
  int argc=0; char **argv=NULL; init_check(&argc,&argv);
  printf("created=%p\n", fc_new(2 /* SELECT_FOLDER */));
}
./Maple_3.3.4_amd64.AppImage --appimage-extract
LD_LIBRARY_PATH=$PWD/squashfs-root/usr/lib GDK_BACKEND=x11 ./gtkprobe
# => Gtk:ERROR:...post_process_ui: assertion failed: (cells)

Suggested fix

  • Defect 1: exclude libraries carrying embedded GResources from the RUNPATH/--replace-needed rewrite, or verify resources still resolve afterwards. Worth auditing whether other bundled GResource-carrying libraries are affected.
  • Defect 2: copy GTK3's schemas into $APPDIR/usr/share/glib-2.0/schemas and run glib-compile-schemas over that directory. The gschema.dtd-only state suggests the copy step is missing rather than misconfigured.
  • Regression check: construct a GtkFileChooserWidget against the packaged AppDir in CI — it catches both defects in one assertion, and would also catch the _gtk_css_provider_load_named regression.
  • Worth considering: enabling rfd's xdg-portal backend on Linux. Portal dialogs avoid the bundled GTK entirely, and match how sandboxed desktop apps are expected to request file access.

Workaround

Shadow the bundled library with stock GTK3 and supply schemas via XDG_DATA_DIRS. Note that AppRun appends inherited LD_LIBRARY_PATH after the AppDir, so it cannot be shadowed from the environment; it prepends $MAPLE_WEBKIT_LIBRARY_PATH, so staging a working libgtk-3.so.0 in the maple-webkitgtk.sh runtime directory does work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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