-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPATH goes missing when using both install_rpath
and an internal shared library dependency
#711
Comments
Adding the relevant content from the {
"targets": {
"/home/.../build-whl/subprojects/openblas/lapack-netlib/SRC/libscipy_lapack.so": {
"destination": "{libdir_shared}/libscipy_lapack.so",
"tag": "runtime",
"subproject": "openblas",
"install_rpath": null
},
"/home/.../build-whl/scipy/special/libsf_error_state.so": {
"destination": "{py_platlib}/scipy/special/libsf_error_state.so",
"tag": "runtime",
"subproject": null,
"install_rpath": null
},
"/home/.../build-whl/scipy/special/_ufuncs.cpython-312-x86_64-linux-gnu.so": {
"destination": "{py_platlib}/scipy/special/_ufuncs.cpython-312-x86_64-linux-gnu.so",
"tag": "runtime",
"subproject": null,
"install_rpath": "$ORIGIN"
}, |
I think the correct behavior for
|
I've tried to brush up on the reason why the RPATH adjustment code does what it does. IIRC, what it needs to do is to remove RPATH entries added by meson that point to the build tree and add an RPATH entry that points to |
"/Users/rgommers/code/pixi-dev/scipy/scipy/build/scipy/special/libsf_error_state.dylib": {
"destination": "{py_platlib}/scipy/special/libsf_error_state.dylib",
"tag": "runtime",
"subproject": null,
"install_rpath": null
},
"/Users/rgommers/code/pixi-dev/scipy/scipy/build/scipy/special/_special_ufuncs.cpython-312-darwin.so": {
"destination": "{py_platlib}/scipy/special/_special_ufuncs.cpython-312-darwin.so",
"tag": "runtime",
"subproject": null,
"install_rpath": "$ORIGIN"
}, This metadata matches with https://github.com/scipy/scipy/blob/1336806190a3810342a6cd74e3aee49d49e3ce20/scipy/special/meson.build#L83. All extension modules and shared libraries have the |
Oh, right, I added that to the meson introspection data exactly for this purpose mesonbuild/meson#13625 🙂 This does not solve the issue for RPATH entries added passing linker arguments, but meson already emits a warning for these and we can say that these are not supported. I guess that what we should do is thus to remove all RPATH entries that are not listed in the introspection data. I'll have a look at this later today. |
Thanks! Always nice to discover you solved the problem you think you're having yourself months ago:) |
This is a case that probably hasn't been exercised before: a Python extension module that links against both a shared library that's part of the package and a shared library built in a subproject that's folded into the wheel by
meson-python
.I ran into this in SciPy when adding a subproject. This worked as advertised, except for this
scipy.special._ufuncs
extension module, which depends on thislibsf_error
shared library as well as on the library in the subproject.What one sees then is that the installed wheel can no longer find
libsf_error.so
, because the RPATH entry forinstall_rpath: '$ORIGIN'
goes missing.With a default SciPy build (no subproject), the
Library rpath|runpath
entries on the_ufuncs
target in the build and install directories looks like this (has$ORIGIN
as it should):On the branch with the subproject, we see this instead:
The duplication of the
.scipy.mesonpy.libs
entries is a minor stylistic issue, we may be able to de-duplicate but it doesn't matter. What does matter is that$ORIGIN
is no longer present.This looks like a bug in the
fix_rpath
implementation at:meson-python/mesonpy/_rpath.py
Lines 28 to 36 in 91d64d1
The problem seems clear: all RPATH entries are cleared, and the ones that are added back all get
libs_relative_path
appended (i.e. to the subproject-relocated location). Any existing RPATHs within the package, like'$ORIGIN'
, will get lost.The text was updated successfully, but these errors were encountered: