Skip to content

Fix dyld libzstd error in distributed macOS binaries#104

Merged
jucasoliveira merged 2 commits into
masterfrom
claude/friendly-blackwell
Apr 16, 2026
Merged

Fix dyld libzstd error in distributed macOS binaries#104
jucasoliveira merged 2 commits into
masterfrom
claude/friendly-blackwell

Conversation

@jucasoliveira
Copy link
Copy Markdown
Contributor

@jucasoliveira jucasoliveira commented Apr 16, 2026

Summary

  • Users installing oitec on macOS without Homebrew's zstd hit a dyld: Library not loaded: libzstd.1.dylib error at runtime
  • Root cause: release builds dynamically linked against Homebrew's libzstd.1.dylib, creating a runtime dependency not present on end-user machines
  • Fix: copy only libzstd.a to an isolated directory (/tmp/zstd-static) and point the linker there first, so it picks the static archive without breaking llvm-config (which itself needs the dylib)

Changes

  • release.yml: Both macOS targets now isolate libzstd.a in /tmp/zstd-static/ and use it as the primary linker search path. Added otool -L post-build verification that fails if the binary still references libzstd dynamically.
  • ci.yml: Switched from 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 missing libzstd-dev to Linux CI.

Test plan

  • CI passes on all three targets (x86_64-linux, aarch64-linux, aarch64-macos)
  • On a release build, otool -L verification step confirms no dynamic zstd reference
  • Install the built binary on a machine without Homebrew zstd — no dyld error

🤖 Generated with Claude Code

jucasoliveira and others added 2 commits April 16, 2026 09:26
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>
@jucasoliveira jucasoliveira self-assigned this Apr 16, 2026
@jucasoliveira jucasoliveira merged commit 19bb810 into master Apr 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI fix caused build error

1 participant