Skip to content

Fixes relative to RPATH handfling#788

Open
dnicolodi wants to merge 12 commits into
mesonbuild:mainfrom
dnicolodi:rpath-fixes
Open

Fixes relative to RPATH handfling#788
dnicolodi wants to merge 12 commits into
mesonbuild:mainfrom
dnicolodi:rpath-fixes

Conversation

@dnicolodi

Copy link
Copy Markdown
Member

Builds on top of #783 and replaces #724

@dnicolodi dnicolodi force-pushed the rpath-fixes branch 5 times, most recently from 3c3bcf5 to f84c84f Compare August 10, 2025 15:54
@dnicolodi dnicolodi marked this pull request as draft August 10, 2025 16:22
@dnicolodi dnicolodi force-pushed the rpath-fixes branch 3 times, most recently from c437265 to 2ab597f Compare June 27, 2026 15:53
This entries are not meaningful. This has the additional benefit of
not returning an empty string RPATH entry for binaries with RPATH unset.
This reorganizes the test package to a flatter layout that helps
visualizing all the parts involved in the test and introduces an
asymmetry between the source layout and the installation layout that
demonstrates the bugs in RPATH handling as currently implemented.
@dnicolodi dnicolodi force-pushed the rpath-fixes branch 3 times, most recently from af28554 to cf8cc06 Compare June 27, 2026 20:08
meson-python does not support `install_rpath` yet and Meson does not
expose it in introspection data prior to version 1.6.0.  Use
`link_args` to set the RPATH.
macOS requires using `@loader_path` in place of `$ORIGIN`.
This shows that build RPATHs are not correctly stripped.
This does not introduce any functional changes, except removing
duplicates entries from RPATH.

Fixes mesonbuild#813.
There is no need to perform the check for every native file installed.
for packages using internal shared libraries relocated by meson-python.
@dnicolodi dnicolodi force-pushed the rpath-fixes branch 6 times, most recently from a32477f to 6dfee91 Compare June 27, 2026 21:59
Revise tests to exercise support when executed with Meson > 1.6
@dnicolodi dnicolodi marked this pull request as ready for review June 27, 2026 22:37
@dnicolodi

Copy link
Copy Markdown
Member Author

This should fix RPATH handling for good.

The only thing not included is automatic translation of the $ORIGIN anchor in install_rpath arguments to @loader_path on macOS. It would not be hard to implement, however, it would be a deviation from what Meson implements. I am not sure it is a good idea to implement it.

There is one case in which this may break projects that work now: when libraries or modules require setting an RPATH to dynamically link to a library installed in the Python install path (with something like install_dir: py.get_install_dir() / 'package') and that work now for how because meson-python does not remove build RPATH entries added by Meson and the source layout matches the install layout. This was the case for example for SciPy 1.15, see #724 (comment) and previous discussion. The comments there indicated that, for what SciPy is concerned, it should be fine to break this now. Note that SciPy 1.15 used install_rpath arguments that are implemented here, thus it would be fine, but it uses the $ORIGIN anchor on macOS too, and that does not work. See above. The behavior changes only with Meson 1.9.0 or later (older Meson versions did not export the required metadata), thus projects that pin the Meson version are fine.

@rgommers I think I added test cases for all scenarios we discussed. It would be great if you could test with packages that may be affected and that do not pin the meson-python version to any released version.

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.

1 participant