From b3fc02d86033189b07b6bbb8afd13edf622d43a8 Mon Sep 17 00:00:00 2001 From: hypersolidbob Date: Fri, 30 Oct 2026 16:43:57 +0100 Subject: [PATCH] fix(release): add @executable_path rpath so the app finds Sparkle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v0.1.6 built via xcodebuild aborted at launch with a DYLD error ("Library not loaded: @rpath/Sparkle.framework/Versions/B/Sparkle"). The binary links Sparkle as @rpath/Sparkle.framework, but xcodebuild's only relocatable rpath is @executable_path/../lib (→ Contents/lib), while make-app-bundle embeds Sparkle at Contents/MacOS. dyld therefore looked in Contents/lib and found nothing. Add a plain @executable_path rpath (= Contents/MacOS) to the binary so @rpath resolves to the embedded framework. Only added when the exact entry is absent (install_name_tool errors on a duplicate; swift build binaries already resolve it), and before signing since it invalidates the signature. Verified locally against the published v0.1.6 products: the app now launches and stays running with no DYLD abort. --- scripts/e2e/make-app-bundle.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/e2e/make-app-bundle.sh b/scripts/e2e/make-app-bundle.sh index 72e505a..8a437f1 100755 --- a/scripts/e2e/make-app-bundle.sh +++ b/scripts/e2e/make-app-bundle.sh @@ -34,11 +34,23 @@ for b in "${BINDIR}"/*.bundle; do ditto "$b" "$APP/Contents/Resources/$(basename "$b")" done -# Embed Sparkle.framework next to the binary so the binary's existing @loader_path rpath -# finds it (dyld searches @loader_path = Contents/MacOS). Avoids install_name_tool. +# Embed Sparkle.framework next to the binary (Contents/MacOS). The binary links it as +# @rpath/Sparkle.framework, so dyld must have an rpath that resolves to this directory. SPARKLE="${BINDIR}/Sparkle.framework" # note: BINDIR may be a symlink, so use the path directly [ -d "$SPARKLE" ] && ditto "$SPARKLE" "$APP/Contents/MacOS/Sparkle.framework" +# xcodebuild-built binaries carry only @executable_path/../lib (→ Contents/lib) as their +# relocatable rpath, so @rpath/Sparkle.framework misses the framework above and the app +# aborts at launch ("Library not loaded: @rpath/Sparkle.framework"). Add a plain +# @executable_path rpath (= Contents/MacOS) so dyld finds it. swift build binaries already +# resolve it; only add when the exact entry is absent (install_name_tool errors on a +# duplicate). Must run before signing — it invalidates any existing signature. +if [ -d "$APP/Contents/MacOS/Sparkle.framework" ]; then + if ! otool -l "$APP/Contents/MacOS/Simpleton" | awk '/LC_RPATH/{f=1;next} f&&/ path /{print $2;f=0}' | grep -Fxq '@executable_path'; then + install_name_tool -add_rpath @executable_path "$APP/Contents/MacOS/Simpleton" + fi +fi + # Sparkle / versioning are env-driven so the release pipeline can bake in the real update # feed, public key, auto-checks, and an incrementing build number — while a plain dev build # keeps the old behavior (auto-checks off, placeholder feed, ad-hoc signed). Env vars: