Skip to content

Fix macOS rpath: emit one -rpath per path instead of colon-joining#222

Merged
antonwolfy merged 2 commits into
masterfrom
use-proper-rpath-set-for-macos
Jul 23, 2026
Merged

Fix macOS rpath: emit one -rpath per path instead of colon-joining#222
antonwolfy merged 2 commits into
masterfrom
use-proper-rpath-set-for-macos

Conversation

@antonwolfy

Copy link
Copy Markdown
Collaborator

The Meson migration gh-174 built the extensions' runtime search path by colon-joining two paths into a single -Wl,-rpath, argument:

-Wl,-rpath,$ORIGIN/../..:$ORIGIN/../../..

Colon-as-separator is an ELF/Linux convention. On macOS (Mach-O) each -rpath produces exactly one LC_RPATH load command and the string is taken verbatim — the colon is not a separator. As a result, macOS extensions shipped a single unusable rpath entry:

LC_RPATH: @loader_path/../..:@loader_path/../../..   ← no such directory

so @rpath/libmkl_rt.*.dylib could not be resolved from the baked-in rpath alone.

This PR emits one -Wl,-rpath, argument per path, restoring the exact per-entry behavior of the legacy setup.py (runtime_library_dirs=["$ORIGIN/../..", "$ORIGIN/../../.."]). This is correct on both Mach-O and ELF.

Emit one -rpath per path. Colon-joining works only for ELF (Linux);
on Mach-O the colon is literal, producing a single unusable LC_RPATH.
@antonwolfy antonwolfy added this to the 2.8.0 release milestone Jul 23, 2026
@antonwolfy antonwolfy self-assigned this Jul 23, 2026

@jharlow-intel jharlow-intel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good ole macos, thanks for fixing this

@antonwolfy
antonwolfy merged commit 28119c3 into master Jul 23, 2026
119 of 122 checks passed
@antonwolfy
antonwolfy deleted the use-proper-rpath-set-for-macos branch July 23, 2026 13:36
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