Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: distinguish gtk/gdk-pixbuf AppImage failures from strip errors

Tw9364a867aaadca
diff --git a/bin/builders/env.ts b/bin/builders/env.ts
index aaf320bf..033a2b46 100644
--- a/bin/builders/env.ts
+++ b/bin/builders/env.ts
@@ -214,6 +214,14 @@ export function isLinuxDeployStripError(error: unknown): boolean {
return false;
}
const message = error.message.toLowerCase();
+ // A gtk-plugin / gdk-pixbuf failure also mentions linuxdeploy but is not a
+ // strip issue, so a NO_STRIP retry won't help. Don't treat it as one.
+ if (
+ message.includes('gdk-pixbuf') ||
+ message.includes('failed to run plugin: gtk')
+ ) {
+ return false;
+ }
return (
message.includes('linuxdeploy') ||
message.includes('failed to run linuxdeploy') ||
diff --git a/bin/utils/shell.ts b/bin/utils/shell.ts
index e857d8f7..64c1e1e7 100644
--- a/bin/utils/shell.ts
+++ b/bin/utils/shell.ts
@@ -29,40 +29,74 @@ export async function shellExec(
let errorMsg = `Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`;
- // Provide helpful guidance for common Linux AppImage build failures
- // caused by strip tool incompatibility with modern glibc (2.38+)
+ // Provide targeted guidance for common Linux AppImage build failures.
+ // A gtk-plugin / gdk-pixbuf failure also mentions linuxdeploy/appimage but
+ // is unrelated to strip, so it must be matched first and given its own hint.
const lowerError = errorMessage.toLowerCase();
+ const divider =
+ '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━';
- if (
- process.platform === 'linux' &&
- (lowerError.includes('linuxdeploy') ||
+ if (process.platform === 'linux') {
+ const isGtkPixbufFailure =
+ lowerError.includes('gdk-pixbuf') ||
+ lowerError.includes('failed to run plugin: gtk');
+ const isAppImageStripFailure =
+ lowerError.includes('linuxdeploy') ||
lowerError.includes('appimage') ||
- lowerError.includes('strip'))
- ) {
- errorMsg +=
- '\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' +
- 'Linux AppImage Build Failed\n' +
- '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n' +
- 'Cause: Strip tool incompatibility with glibc 2.38+\n' +
- ' (affects Debian Trixie, Arch Linux, and other modern distros)\n\n' +
- 'Quick fix:\n' +
- ' NO_STRIP=1 pake <url> --targets appimage --debug\n\n' +
- 'Alternatives:\n' +
- ' • Use DEB format: pake <url> --targets deb\n' +
- ' • Update binutils: sudo apt install binutils (or pacman -S binutils)\n' +
- ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
- '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━';
+ lowerError.includes('strip');
+ const noStripActive = !!(env?.NO_STRIP || process.env.NO_STRIP);
- if (
- lowerError.includes('fuse') ||
- lowerError.includes('operation not permitted') ||
- lowerError.includes('/dev/fuse')
- ) {
+ if (isGtkPixbufFailure) {
errorMsg +=
- '\n\nDocker / Container hint:\n' +
- ' AppImage tooling needs access to /dev/fuse. When running inside Docker, add:\n' +
- ' --privileged --device /dev/fuse --security-opt apparmor=unconfined\n' +
- ' or run on the host directly.';
+ `\n\n${divider}\n` +
+ 'Linux AppImage Build Failed\n' +
+ `${divider}\n\n` +
+ "Cause: linuxdeploy's gtk plugin could not find the gdk-pixbuf loaders\n" +
+ ' (e.g. "cannot stat \'/usr/lib/gdk-pixbuf-2.0/...\'").\n\n' +
+ 'Quick fix:\n' +
+ ' • Install the gdk-pixbuf loaders for your distro:\n' +
+ ' Arch: sudo pacman -S gdk-pixbuf2 librsvg\n' +
+ ' Debian: sudo apt install librsvg2-common gdk-pixbuf2.0-bin\n' +
+ ' Fedora: sudo dnf install gdk-pixbuf2-modules librsvg2\n' +
+ ' • Refresh the loader cache, then rebuild:\n' +
+ ' gdk-pixbuf-query-loaders --update-cache\n\n' +
+ 'Alternative:\n' +
+ ' • Use DEB format instead: pake <url> --targets deb\n' +
+ ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
+ divider;
+ } else if (isAppImageStripFailure) {
+ errorMsg +=
+ `\n\n${divider}\n` +
+ 'Linux AppImage Build Failed\n' +
+ `${divider}\n\n` +
+ 'Cause: Strip tool incompatibility with glibc 2.38+\n' +
+ ' (affects Debian Trixie, Arch Linux, and other modern distros)\n\n';
+
+ errorMsg += noStripActive
+ ? 'NO_STRIP=1 is already set but the build still failed, so this is\n' +
+ 'likely not a strip issue. Try the alternatives below or rerun with\n' +
+ '--debug and read the linuxdeploy output above for the real cause.\n\n'
+ : 'Quick fix:\n' +
+ ' NO_STRIP=1 pake <url> --targets appimage --debug\n\n';
+
+ errorMsg +=
+ 'Alternatives:\n' +
+ ' • Use DEB format: pake <url> --targets deb\n' +
+ ' • Update binutils: sudo apt install binutils (or pacman -S binutils)\n' +
+ ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
+ divider;
+
+ if (
+ lowerError.includes('fuse') ||
+ lowerError.includes('operation not permitted') ||
+ lowerError.includes('/dev/fuse')
+ ) {
+ errorMsg +=
+ '\n\nDocker / Container hint:\n' +
+ ' AppImage tooling needs access to /dev/fuse. When running inside Docker, add:\n' +
+ ' --privileged --device /dev/fuse --security-opt apparmor=unconfined\n' +
+ ' or run on the host directly.';
+ }
}
}
diff --git a/dist/cli.js b/dist/cli.js
index 3b51b1a5..01dd1c61 100644
--- a/dist/cli.js
+++ b/dist/cli.js
@@ -249,34 +249,65 @@ async function shellExec(command, timeout = 300000, env) {
throw new Error(`Command timed out after ${timeout}ms: "${command}". Try increasing timeout or check network connectivity.`);
}
let errorMsg = `Error occurred while executing command "${command}". Exit code: ${exitCode}. Details: ${errorMessage}`;
- // Provide helpful guidance for common Linux AppImage build failures
- // caused by strip tool incompatibility with modern glibc (2.38+)
+ // Provide targeted guidance for common Linux AppImage build failures.
+ // A gtk-plugin / gdk-pixbuf failure also mentions linuxdeploy/appimage but
+ // is unrelated to strip, so it must be matched first and given its own hint.
const lowerError = errorMessage.toLowerCase();
- if (process.platform === 'linux' &&
- (lowerError.includes('linuxdeploy') ||
+ const divider = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━';
+ if (process.platform === 'linux') {
+ const isGtkPixbufFailure = lowerError.includes('gdk-pixbuf') ||
+ lowerError.includes('failed to run plugin: gtk');
+ const isAppImageStripFailure = lowerError.includes('linuxdeploy') ||
lowerError.includes('appimage') ||
- lowerError.includes('strip'))) {
- errorMsg +=
- '\n\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' +
- 'Linux AppImage Build Failed\n' +
- '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n' +
- 'Cause: Strip tool incompatibility with glibc 2.38+\n' +
- ' (affects Debian Trixie, Arch Linux, and other modern distros)\n\n' +
- 'Quick fix:\n' +
- ' NO_STRIP=1 pake <url> --targets appimage --debug\n\n' +
- 'Alternatives:\n' +
- ' • Use DEB format: pake <url> --targets deb\n' +
- ' • Update binutils: sudo apt install binutils (or pacman -S binutils)\n' +
- ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
- '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━';
- if (lowerError.includes('fuse') ||
- lowerError.includes('operation not permitted') ||
- lowerError.includes('/dev/fuse')) {
+ lowerError.includes('strip');
+ const noStripActive = !!(env?.NO_STRIP || process.env.NO_STRIP);
+ if (isGtkPixbufFailure) {
+ errorMsg +=
+ `\n\n${divider}\n` +
+ 'Linux AppImage Build Failed\n' +
+ `${divider}\n\n` +
+ "Cause: linuxdeploy's gtk plugin could not find the gdk-pixbuf loaders\n" +
+ ' (e.g. "cannot stat \'/usr/lib/gdk-pixbuf-2.0/...\'").\n\n' +
+ 'Quick fix:\n' +
+ ' • Install the gdk-pixbuf loaders for your distro:\n' +
+ ' Arch: sudo pacman -S gdk-pixbuf2 librsvg\n' +
+ ' Debian: sudo apt install librsvg2-common gdk-pixbuf2.0-bin\n' +
+ ' Fedora: sudo dnf install gdk-pixbuf2-modules librsvg2\n' +
+ ' • Refresh the loader cache, then rebuild:\n' +
+ ' gdk-pixbuf-query-loaders --update-cache\n\n' +
+ 'Alternative:\n' +
+ ' • Use DEB format instead: pake <url> --targets deb\n' +
+ ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
+ divider;
+ }
+ else if (isAppImageStripFailure) {
+ errorMsg +=
+ `\n\n${divider}\n` +
+ 'Linux AppImage Build Failed\n' +
+ `${divider}\n\n` +
+ 'Cause: Strip tool incompatibility with glibc 2.38+\n' +
+ ' (affects Debian Trixie, Arch Linux, and other modern distros)\n\n';
+ errorMsg += noStripActive
+ ? 'NO_STRIP=1 is already set but the build still failed, so this is\n' +
+ 'likely not a strip issue. Try the alternatives below or rerun with\n' +
+ '--debug and read the linuxdeploy output above for the real cause.\n\n'
+ : 'Quick fix:\n' +
+ ' NO_STRIP=1 pake <url> --targets appimage --debug\n\n';
errorMsg +=
- '\n\nDocker / Container hint:\n' +
- ' AppImage tooling needs access to /dev/fuse. When running inside Docker, add:\n' +
- ' --privileged --device /dev/fuse --security-opt apparmor=unconfined\n' +
- ' or run on the host directly.';
+ 'Alternatives:\n' +
+ ' • Use DEB format: pake <url> --targets deb\n' +
+ ' • Update binutils: sudo apt install binutils (or pacman -S binutils)\n' +
+ ' • Detailed guide: https://github.com/tw93/Pake/blob/main/docs/faq.md\n' +
+ divider;
+ if (lowerError.includes('fuse') ||
+ lowerError.includes('operation not permitted') ||
+ lowerError.includes('/dev/fuse')) {
+ errorMsg +=
+ '\n\nDocker / Container hint:\n' +
+ ' AppImage tooling needs access to /dev/fuse. When running inside Docker, add:\n' +
+ ' --privileged --device /dev/fuse --security-opt apparmor=unconfined\n' +
+ ' or run on the host directly.';
+ }
}
}
throw new Error(errorMsg);
@@ -929,6 +960,12 @@ function isLinuxDeployStripError(error) {
return false;
}
const message = error.message.toLowerCase();
+ // A gtk-plugin / gdk-pixbuf failure also mentions linuxdeploy but is not a
+ // strip issue, so a NO_STRIP retry won't help. Don't treat it as one.
+ if (message.includes('gdk-pixbuf') ||
+ message.includes('failed to run plugin: gtk')) {
+ return false;
+ }
return (message.includes('linuxdeploy') ||
message.includes('failed to run linuxdeploy') ||
message.includes('strip:') ||