From 352d9085c3fe5c7422d7471881de445b19480ce1 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 12 Jun 2026 04:12:06 -0400 Subject: [PATCH] fix: pre-stage linuxdeploy plugins; add wrapper diagnostic log --- .gitea/workflows/release.yml | 12 ++++++++++++ tools/ld_wrapper.c | 22 ++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 689d6f1..ce7b1db 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -188,6 +188,14 @@ jobs: ls /root/linuxdeploy-root/ ls /root/linuxdeploy-root/usr/bin/ 2>/dev/null || echo "no usr/bin" + # Pre-stage plugin scripts next to linuxdeploy so it finds them via /proc/self/exe lookup + wget -q "https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh" \ + -O /root/linuxdeploy-root/usr/bin/linuxdeploy-plugin-gtk.sh + wget -q "https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gstreamer/master/linuxdeploy-plugin-gstreamer.sh" \ + -O /root/linuxdeploy-root/usr/bin/linuxdeploy-plugin-gstreamer.sh + chmod +x /root/linuxdeploy-root/usr/bin/linuxdeploy-plugin-gtk.sh \ + /root/linuxdeploy-root/usr/bin/linuxdeploy-plugin-gstreamer.sh + gcc -o ~/.cache/tauri/linuxdeploy-x86_64.AppImage tools/ld_wrapper.c chmod +x ~/.cache/tauri/linuxdeploy-x86_64.AppImage @@ -199,6 +207,10 @@ jobs: RUST_LOG: tauri_bundler=debug run: npm run tauri -- build --bundles appimage,deb + - name: Show linuxdeploy wrapper log + if: always() + run: cat /tmp/ld-wrapper.log 2>/dev/null || echo "no wrapper log found" + - name: Upload to release env: TOKEN: ${{ secrets.RELEASE_TOKEN }} diff --git a/tools/ld_wrapper.c b/tools/ld_wrapper.c index f19c548..1a00ede 100644 --- a/tools/ld_wrapper.c +++ b/tools/ld_wrapper.c @@ -12,15 +12,13 @@ int main(int argc, char **argv) { snprintf(apprun, sizeof(apprun), "%s/AppRun", appdir); snprintf(ldbin, sizeof(ldbin), "%s/usr/bin/linuxdeploy", appdir); - /* Strip --appimage-extract-and-run: that's an AppImage runtime flag, - not a linuxdeploy flag. Passing it to the real binary causes immediate failure. */ + /* Strip --appimage-extract-and-run: AppImage runtime flag, not a linuxdeploy flag */ char **new_argv = malloc((argc + 1) * sizeof(char *)); int new_argc = 0; new_argv[new_argc++] = argv[0]; for (int i = 1; i < argc; i++) { - if (strcmp(argv[i], "--appimage-extract-and-run") != 0) { + if (strcmp(argv[i], "--appimage-extract-and-run") != 0) new_argv[new_argc++] = argv[i]; - } } new_argv[new_argc] = NULL; @@ -35,9 +33,21 @@ int main(int argc, char **argv) { appdir, appdir, old_ldpath ? old_ldpath : ""); setenv("LD_LIBRARY_PATH", new_ldpath, 1); - if (stat(ldbin, &st) == 0) { - execv(ldbin, new_argv); + /* Write diagnostic log visible in the always() post-step */ + FILE *log = fopen("/tmp/ld-wrapper.log", "w"); + if (log) { + fprintf(log, "APPDIR=%s\n", appdir); + fprintf(log, "AppRun exists: %s\n", stat(apprun, &st) == 0 ? "yes" : "NO"); + fprintf(log, "linuxdeploy exists: %s\n", stat(ldbin, &st) == 0 ? "yes" : "NO"); + fprintf(log, "argc=%d new_argc=%d\n", argc, new_argc); + fprintf(log, "args:"); + for (int i = 0; i < new_argc; i++) fprintf(log, " [%s]", new_argv[i]); + fprintf(log, "\nPATH=%s\n", getenv("PATH") ? getenv("PATH") : "(null)"); + fclose(log); } + + if (stat(ldbin, &st) == 0) + execv(ldbin, new_argv); execv(apprun, new_argv); return 1; }