From 6ce803ca756795177fdb708dde9690a6a6e63589 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Thu, 2 Jul 2026 15:56:58 -0500 Subject: [PATCH] fix: libxkbcommon appimage issue The appimage was trying to dynamically link this library with the wrong path because it wasn't included in appimage. Exclude it so that it links to the system library. --- build.zig | 2 +- build_app_image.sh => build/build_app_image.sh | 3 ++- flake.nix | 5 ----- src/ui/sdl.zig | 7 ++++--- 4 files changed, 7 insertions(+), 10 deletions(-) rename build_app_image.sh => build/build_app_image.sh (85%) diff --git a/build.zig b/build.zig index 1614f00..2396fe1 100644 --- a/build.zig +++ b/build.zig @@ -279,7 +279,7 @@ fn build_linux_app_image( const buffer = b.build_root.handle.readFileAlloc( b.graph.io, - "build_app_image.sh", + "./build/build_app_image.sh", allocator, .limited(1024 * 1024), ) catch unreachable; diff --git a/build_app_image.sh b/build/build_app_image.sh similarity index 85% rename from build_app_image.sh rename to build/build_app_image.sh index ea8a83e..68d0567 100755 --- a/build_app_image.sh +++ b/build/build_app_image.sh @@ -8,13 +8,14 @@ export NO_STRIP=1 rm -rf AppDir rm -f zig-out/linux/spacecap-linux-x86_64.AppImage -# NOTE: Vulkan is excluded because system libraries should be used. +# NOTE: Vulkan and libxkbcommon are excluded because they should be provided by the host. LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}" linuxdeploy \ --appdir AppDir \ --executable zig-out/linux/spacecap \ --desktop-file packaging/linux/spacecap.desktop \ --icon-file packaging/spacecap.svg \ --exclude-library libvulkan.so.1 \ + --exclude-library libxkbcommon.so.0 \ --library "$GTK3_LIB" \ --library "$APPINDICATOR_LIB" diff --git a/flake.nix b/flake.nix index 1b52d78..412bc63 100644 --- a/flake.nix +++ b/flake.nix @@ -133,13 +133,8 @@ # Required for linux tray icon. pkgs.gtk3 pkgs.libayatana-appindicator - - # SDL runtime backends (don't rely on ffmpeg closure for these). pkgs.wayland - pkgs.libxkbcommon ]; - - # TODO: Separate devShell for building appimage. }; } ); diff --git a/src/ui/sdl.zig b/src/ui/sdl.zig index e6b1ba7..56669ce 100644 --- a/src/ui/sdl.zig +++ b/src/ui/sdl.zig @@ -44,7 +44,7 @@ pub fn get_sdl_vulkan_extensions(allocator: std.mem.Allocator) !SDLVulkanExtensi }; } -/// If Linux, try Wayland, fallback to x11. +/// If Linux, try Wayland, fallback to x11, which causes a panic because it's not supported. pub fn init() !void { _ = imguiz.SDL_SetHint(imguiz.SDL_HINT_APP_NAME, "Spacecap"); _ = imguiz.SDL_SetHint(imguiz.SDL_HINT_APP_ID, "spacecap"); @@ -55,8 +55,9 @@ pub fn init() !void { return; } if (try try_sdl_init_with_hint("x11")) { - log.info("[sdl_init] using x11", .{}); - return; + const message = "[sdl_init] using x11, which is not supported."; + log.err(message, .{}); + @panic(message); } return error.SDLInitFailure; }