From 7239eb5168dc7dceb283af54a99874aa2c6f3988 Mon Sep 17 00:00:00 2001 From: cyanyux Date: Tue, 2 Jun 2026 18:44:26 +0800 Subject: [PATCH] fix(snap): make bundled magick find libgomp at runtime The `magick` part builds ImageMagick from source with `--prefix=/usr`, so its own libraries are installed to `usr/lib`, and the binary's RPATH (set by `enable-patchelf`) is `$ORIGIN/../lib`. However, `libgomp1` is pulled in as a stage-package and installs `libgomp.so.1` into the multiarch directory `usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/`, which is not on that RPATH. As a result the bundled binary fails to start whenever yazi invokes it for Font/HEIC/JPEG-XL previews: magick: error while loading shared libraries: libgomp.so.1: cannot open shared object file: No such file or directory Relocate the bundled libgomp alongside the Magick libraries in `usr/lib` so the existing `$ORIGIN/../lib` RPATH resolves it. Verified by placing libgomp on that path next to the shipped binary and running it with no LD_LIBRARY_PATH set. --- snap/snapcraft.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 78abbfe2..91e5949f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -133,9 +133,16 @@ parts: - --prefix=/usr build-attributes: - enable-patchelf + organize: + # `libgomp1` installs libgomp into the multiarch directory, but the + # `magick` binary's RPATH only searches `$ORIGIN/../lib` (i.e. usr/lib). + # Move it alongside the Magick libraries so the bundled binary can load + # it at runtime; otherwise magick fails with: + # "libgomp.so.1: cannot open shared object file: No such file or directory" + usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libgomp.so*: usr/lib/ prime: - usr/bin/magick - - usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libgomp.so.1 + - usr/lib/libgomp.so* - usr/lib/libMagickCore-7.Q16HDRI.so* - usr/lib/libMagickWand-7.Q16HDRI.so*