Skip to content

Commit a04d7a8

Browse files
committed
Bake the RPATH into the extensions via a literal linker argument rather than
`install_rpath`. Meson rewrites `install_rpath` at install time (and the value is further mangled by conda-build relocation), which leaves published wheels without a working `$ORIGIN` entry. Passing `-Wl,-rpath,...` directly writes the RPATH into the binary verbatim -- matching the legacy setuptools behaviour -- so the wheel locates the MKL runtime without any post-build tooling.
1 parent f5be62c commit a04d7a8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

meson.build

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ mkl_dep = dependency('MKL', method: 'cmake',
2828
required: true
2929
)
3030

31-
rpath = ''
31+
rpath_link_args = []
3232
if host_machine.system() != 'windows'
3333
if host_machine.system() == 'darwin'
3434
origin = '@loader_path'
3535
else
3636
origin = '$ORIGIN'
3737
endif
3838
rpath = origin / '../..' + ':' + origin / '../../..'
39+
rpath_link_args = ['-Wl,-rpath,' + rpath]
3940
endif
4041

4142
# C extension
@@ -44,7 +45,7 @@ py.extension_module(
4445
sources: ['mkl/_mklinitmodule.c'],
4546
dependencies: [mkl_dep, thread_dep],
4647
c_args: c_args + ['-DUSING_MKL_RT'],
47-
install_rpath: rpath,
48+
link_args: rpath_link_args,
4849
install: true,
4950
subdir: 'mkl'
5051
)
@@ -55,7 +56,7 @@ py.extension_module(
5556
sources: ['mkl/_py_mkl_service.pyx'],
5657
dependencies: [mkl_dep],
5758
c_args: c_args,
58-
install_rpath: rpath,
59+
link_args: rpath_link_args,
5960
install: true,
6061
subdir: 'mkl'
6162
)

0 commit comments

Comments
 (0)