Skip to content

fix(macos): bundle SDL3 for sdl2-compat at install time - #1226

Merged
nielsvanvelzen merged 1 commit into
jellyfin:masterfrom
andersonvom:bundle-sdl3
Aug 13, 2026
Merged

fix(macos): bundle SDL3 for sdl2-compat at install time#1226
nielsvanvelzen merged 1 commit into
jellyfin:masterfrom
andersonvom:bundle-sdl3

Conversation

@andersonvom

Copy link
Copy Markdown
Contributor

Homebrew replaced its sdl2 formula with sdl2-compat, a compatibility layer that provides the SDL2 API by dlopen-ing the real SDL3 library at runtime. The macOS CI build (build-macos.yml) pulls this via brew install mpv, so the app now links libSDL2-2.0.0.dylib which is actually sdl2-compat, and every nightly ships it in Contents/Frameworks.

SDL3 is not a linker dependency, so it never shows up in otool -L output and the CompleteBundleMac fixup loop never copies it into the app bundle. At runtime sdl2-compat looks for libSDL3.dylib relative to its own loader path, cannot find it, prints "Failed loading SDL3 library." and aborts during dyld initialization, since the library is missing. This regression appeared once Homebrew's SDL2 became the sdl2-compat shim, so older nightly builds (built against genuine SDL2) are unaffected.

This detects sdl2-compat inside the bundle (it is the only libSDL2-2.0.0.dylib containing the libSDL3.dylib loader string) and explicitly copies libSDL3 from the Homebrew prefix into Contents/Frameworks/libSDL3.dylib, using the same install-id convention as the other bundled dylibs so codesign and the existing fixup steps keep working. If SDL3 cannot be found at install time a warning is printed instead of failing silently.

Fixes #1225

Homebrew replaced its `sdl2` formula with `sdl2-compat`, a compatibility
layer that provides the SDL2 API by `dlopen`-ing the real SDL3 library
at runtime. The macOS CI build (`build-macos.yml`) pulls this via `brew
install mpv`, so the app now links `libSDL2-2.0.0.dylib` which is
actually `sdl2-compat`, and every nightly ships it in
`Contents/Frameworks`.

SDL3 is not a linker dependency, so it never shows up in `otool -L`
output and the `CompleteBundleMac` fixup loop never copies it into the
app bundle. At runtime `sdl2-compat` looks for `libSDL3.dylib` relative
to its own loader path, cannot find it, prints "Failed loading SDL3
library." and aborts during dyld initialization, since the library is
missing. This regression appeared once Homebrew's SDL2 became the
`sdl2-compat` shim, so older nightly builds (built against genuine SDL2)
are unaffected.

This detects `sdl2-compat` inside the bundle (it is the only
`libSDL2-2.0.0.dylib` containing the `libSDL3.dylib` loader string) and
explicitly copies libSDL3 from the Homebrew prefix into
`Contents/Frameworks/libSDL3.dylib`, using the same `install-id`
convention as the other bundled dylibs so `codesign` and the existing
fixup steps keep working. If SDL3 cannot be found at install time a
warning is printed instead of failing silently.

Fixes jellyfin#1225
@github-actions

Copy link
Copy Markdown

Test Coverage

Summary coverage rate:
  lines......: 6.0% (333 of 5510 lines)
  functions..: 8.7% (58 of 663 functions)

@nielsvanvelzen
nielsvanvelzen merged commit 3d759cb into jellyfin:master Aug 13, 2026
1 check passed
@andersonvom
andersonvom deleted the bundle-sdl3 branch August 13, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On macOS Apple Silicon, the app fails to launch with a fatal error dialog: "Failed loading SDL3 library."

2 participants