Fix dyld libzstd error in distributed macOS binaries#104
Merged
Conversation
The previous approach of removing libzstd*.dylib broke llvm-config, which itself dynamically links to zstd. Instead, copy only libzstd.a to an isolated directory (/tmp/zstd-static) and point the linker there first, so it picks the static archive without disturbing LLVM tools. Also adds a post-build otool check to verify no dynamic zstd reference remains, and updates CI to test all release targets (adds ubuntu-arm and libzstd-dev, switches from os-only matrix to target-based matrix). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
oitecon macOS without Homebrew's zstd hit adyld: Library not loaded: libzstd.1.dyliberror at runtimelibzstd.1.dylib, creating a runtime dependency not present on end-user machineslibzstd.ato an isolated directory (/tmp/zstd-static) and point the linker there first, so it picks the static archive without breakingllvm-config(which itself needs the dylib)Changes
libzstd.ain/tmp/zstd-static/and use it as the primary linker search path. Addedotool -Lpost-build verification that fails if the binary still references libzstd dynamically.os: [ubuntu-latest, macos-latest]to a target-based matrix matching release.yml (x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,aarch64-apple-darwin). Added missinglibzstd-devto Linux CI.Test plan
otool -Lverification step confirms no dynamic zstd reference🤖 Generated with Claude Code