Skip to content

Commit 626a76c

Browse files
committed
rust
1 parent 4b8190d commit 626a76c

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

content/posts/gstmac.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
+++
2+
title = "How We Fixed macOS GStreamer Library Path Issues in Rust Releases"
3+
date = "2025-09-02"
4+
[taxonomies]
5+
tags=["GStreamer", "macOS", "Rust"]
6+
+++
7+
8+
## <span style="color:orange;">How We Fixed macOS GStreamer Library Path Issues in Rust Releases</span>
9+
10+
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:
11+
12+
```bash
13+
objc[43583]: Class GstCocoaApplicationDelegate is implemented in both
14+
/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libgstreamer-1.0.0.dylib
15+
and /Users/user/app/gstreamer/lib/libgstreamer-1.0.0.dylib
16+
```
17+
18+
### <span style="color:orange;">The Problem</span>
19+
20+
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.
21+
22+
### <span style="color:orange;">The Root Cause</span>
23+
24+
Rust binaries don't have enough header padding by default for `install_name_tool` to modify library paths.
25+
26+
### <span style="color:orange;">The Solution</span>
27+
28+
Add this linker flag to your macOS Rust builds:
29+
30+
```bash
31+
export RUSTFLAGS="$RUSTFLAGS -C link-arg=-Wl,-headerpad_max_install_names"
32+
```
33+
34+
This reserves enough space in the binary header for dynamic library path modifications.
35+
36+
- **Before:** Binary had unfixable `@rpath` entries → loaded both system and bundled GStreamer → conflicts
37+
- **After:** Binary library paths properly fixed → loads only bundled GStreamer → works perfectly
38+
39+
### <span style="color:orange;">Key Lesson</span>
40+
41+
Always verify that your `install_name_tool` commands actually succeed. Silent failures can waste hours of debugging!

0 commit comments

Comments
 (0)