From 698e01af4c7c2d647d6724ecd447f0125d8bd5d2 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 28 Sep 2026 11:49:47 +0200 Subject: [PATCH 1/2] Migrate RPATH handling to meson-python install_rpath Consolidate the installed runtime library search paths into a single install_rpath argument on the loops shared library and both extension modules, replacing the previous -Wl,-rpath link_args workaround. meson-python 0.22 honors install_rpath and no longer preserves the RPATH entries meson auto-inserts for internal link_with dependencies, so the extension modules could no longer locate the co-located libmkl_umath_loops.so at import time on Linux/macOS. Requesting the package directory ($ORIGIN / @loader_path) via install_rpath restores that, and folds the MKL runtime search paths into the same mechanism. Raise the minimum build-time meson-python requirement to 0.22.0 in pyproject.toml and both conda recipes accordingly. --- conda-recipe-cf/meta.yaml | 2 +- conda-recipe/meta.yaml | 2 +- meson.build | 31 +++++++++++++++++++++++-------- pyproject.toml | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/conda-recipe-cf/meta.yaml b/conda-recipe-cf/meta.yaml index 311b08d3..1c7c8da5 100644 --- a/conda-recipe-cf/meta.yaml +++ b/conda-recipe-cf/meta.yaml @@ -22,7 +22,7 @@ requirements: - {{ stdlib('c') }} - {{ compiler('dpcpp') }} >=2024.2 # [not osx] host: - - meson-python >=0.16.0 + - meson-python >=0.22.0 - cmake - ninja - git diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 44932c77..94ce7d13 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -21,7 +21,7 @@ requirements: - {{ stdlib('c') }} - {{ compiler('dpcpp') }} >=2024.2 # [not osx] host: - - meson-python >=0.16.0 + - meson-python >=0.22.0 - cmake - ninja - git diff --git a/meson.build b/meson.build index 6048f493..ab7774bf 100644 --- a/meson.build +++ b/meson.build @@ -149,7 +149,16 @@ gen_loops_h = custom_target( depends: gen_umath_c ) -rpath_link_args = [] +# Runtime library search paths for the installed targets, relative to each +# target's own location: +# - origin -> the mkl_umath package directory, where +# libmkl_umath_loops.so is installed alongside the +# extension modules that link against it +# - origin/../.. \ the environment's library directory, where the MKL +# - origin/../../.. / runtime libraries live +# These are applied via the install_rpath argument. Empty on Windows, +# which has no RPATH concept. +install_rpath_dirs = '' if host_machine.system() != 'windows' if host_machine.system() == 'darwin' origin = '@loader_path' @@ -157,10 +166,13 @@ if host_machine.system() != 'windows' origin = '$ORIGIN' endif - rpath_link_args = [ - '-Wl,-rpath,' + origin / '../..', - '-Wl,-rpath,' + origin / '../../..', - ] + install_rpath_dirs = ':'.join( + [ + origin, + origin / '../..', + origin / '../../..', + ] + ) endif # define _EXPORTS for Windows dllexport @@ -170,7 +182,8 @@ mkl_umath_loops = shared_library( include_directories: inc_np, dependencies: [mkl_dep, py_dep], c_args: c_args + ['-Dmkl_umath_loops_EXPORTS'], - link_args: link_args + rpath_link_args, + link_args: link_args, + install_rpath: install_rpath_dirs, install: true, install_dir: py.get_install_dir() / 'mkl_umath' ) @@ -185,7 +198,8 @@ py.extension_module( include_directories: inc_np, dependencies: [mkl_dep, loops_dep], c_args: c_args + ['-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION'], - link_args: link_args + rpath_link_args, + link_args: link_args, + install_rpath: install_rpath_dirs, install: true, subdir: 'mkl_umath' ) @@ -197,7 +211,8 @@ py.extension_module( dependencies: [loops_dep], c_args: c_args + ['-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION'], cython_args: ['-3', '--fast-fail'], - link_args: link_args + rpath_link_args, + link_args: link_args, + install_rpath: install_rpath_dirs, install: true, subdir: 'mkl_umath' ) diff --git a/pyproject.toml b/pyproject.toml index 13f65fb4..c8a4a5e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ [build-system] build-backend = "mesonpy" requires = [ - "meson-python>=0.16.0", + "meson-python>=0.22.0", "ninja", "Cython>=3.1.0", "numpy", From 94652649b00c8d1b53753fd67064294d55a94314 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Mon, 28 Sep 2026 13:16:09 +0200 Subject: [PATCH 2/2] Add changelog entry for install_rpath migration --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a799ed64..4155850e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Raised the minimum build-time `Cython` requirement to `3.1.0`, the first release providing the `freethreading_compatible` directive [gh-255](https://github.com/IntelPython/mkl_umath/pull/255) * Pinned Cython in the Coverity Scan workflow so generated code stays stable between scans, and added `coverity/README.md` documenting the known Cython-boilerplate false positives and the scan review checklist [gh-266](https://github.com/IntelPython/mkl_umath/pull/266) +* Migrated the installed RPATH handling to `meson-python`'s `install_rpath` argument, replacing the previous `-Wl,-rpath` `link_args` workaround, and raised the minimum build-time `meson-python` requirement to `0.22.0` [gh-274](https://github.com/IntelPython/mkl_umath/pull/274) ### Fixed * Fixed `absolute` (float32/float64) returning `-NaN` for `+NaN` input on the scalar fallback path (same issue as numpy/numpy@dc478c58b9, gh-31433) [gh-269](https://github.com/IntelPython/mkl_umath/pull/269)