Skip to content

Fix missing transitive rpath for fetched dependencies on macOS#31

Closed
cbjeukendrup wants to merge 1 commit into
musescore:mainfrom
cbjeukendrup:macos-dep-transitive-rpath
Closed

Fix missing transitive rpath for fetched dependencies on macOS#31
cbjeukendrup wants to merge 1 commit into
musescore:mainfrom
cbjeukendrup:macos-dep-transitive-rpath

Conversation

@cbjeukendrup

Copy link
Copy Markdown
Collaborator

This is an AI-assisted fix for an issue on macOS, where builds failed to run because they failed to find libpng, a transitive dependency of freetype.


_bd_relocatable_macos never received depends_prefixes, unlike its
Linux counterpart _bd_relocatable_elf, so a fetched dependency's own
dylib never got an rpath entry for its own dependencies' lib
directories. Any binary linking only the top-level dependency (not its
transitive shared-lib dependencies) would then fail to load at
runtime with a dyld "Library not loaded" error, since neither the
binary nor the dependency's dylib recorded where to find it.

Mirror the existing patchelf-based Linux logic: add
install_name_tool -add_rpath calls using @loader_path-relative paths
to each dependency prefix's lib directory.

_bd_relocatable_macos never received depends_prefixes, unlike its
Linux counterpart _bd_relocatable_elf, so a fetched dependency's own
dylib never got an rpath entry for its own dependencies' lib
directories. Any binary linking only the top-level dependency (not its
transitive shared-lib dependencies) would then fail to load at
runtime with a dyld "Library not loaded" error, since neither the
binary nor the dependency's dylib recorded where to find it.

Mirror the existing patchelf-based Linux logic: add
install_name_tool -add_rpath calls using @loader_path-relative paths
to each dependency prefix's lib directory.
@cbjeukendrup

Copy link
Copy Markdown
Collaborator Author

@kryksyh Would you mind taking a look?

@kryksyh

kryksyh commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

@cbjeukendrup thank you! merged via #33

@kryksyh kryksyh closed this Jul 15, 2026
@cbjeukendrup
cbjeukendrup deleted the macos-dep-transitive-rpath branch July 15, 2026 09:43
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.

2 participants