Posted on

Table of Contents

How We Fixed macOS GStreamer Library Path Issues in Rust Releases

I spent hours debugging why our Rust application worked perfectly in development but failed with GStreamer library conflicts in release builds on macOS. Users would see this error when double-clicking the app:

  objc[43583]: Class GstCocoaApplicationDelegate is implemented in both
  /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libgstreamer-1.0.0.dylib
  and /Users/user/app/gstreamer/lib/libgstreamer-1.0.0.dylib

The Problem

Our GitHub Actions release script was trying to fix @rpath entries using install_name_tool to point to bundled libraries, but the commands were silently failing.

The Root Cause

Rust binaries don't have enough header padding by default for install_name_tool to modify library paths.

The Solution

Add this linker flag to your macOS Rust builds:

export RUSTFLAGS="$RUSTFLAGS -C link-arg=-Wl,-headerpad_max_install_names"

This reserves enough space in the binary header for dynamic library path modifications.

  • Before: Binary had unfixable @rpath entries → loaded both system and bundled GStreamer → conflicts
  • After: Binary library paths properly fixed → loads only bundled GStreamer → works perfectly

Key Lesson

Always verify that your install_name_tool commands actually succeed. Silent failures can waste hours of debugging!


Cite:

Altun, E. (2025, September 02). How We Fixed macOS GStreamer Library Path Issues in Rust Releases. Retrieved from https://altunenes.github.io/posts/gstmac/

CC BY 4.0