meson-python duplicate lc_rpath #812
-
|
Putting this here as I suspect the issue is related to a misconfiguration on my machine rather than a bug in meson-python. When building with meson python on a recent version of macOS I can no longer import my module. import gridfireWhen I inspect the shared object file with otool I see that it contains many duplicate LC_RPATH entries otool -l gridfire.cpython-313-darwin.so | grep RPATH -A2If I manually remove all but one of the rpath instances using install_name_tool install_name_tool -delete_rpath @loader_path/.gridfire.mesonpy.libsThen I can import and use my module just fine. Presumably then I could write some somewhat convoluted but not too complex tool to use otool to count the number of duplicate paths and remove them; however, I'm sure this strikes me as a one-way street to a bad time (lack of portability, and just a generally convoluted build step).
My question then is how do I prevent meson-python from adding all these duplicate paths to the shared object file? Details
Other details
otool -l libgridfire.dylib | grep RPATH -A2 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
meson-python/mesonpy/_rpath.py Lines 41 to 44 in 3c6b89d It looks like mesonpy replaces each rpath with its own internal rpath, rather than removing the ones it doesn't want and adding a single instance of the internal rpath. (mesonpy.libs indeed doesn't come from Meson itself -- it's added during wheel generation postprocessing.) |
Beta Was this translation helpful? Give feedback.
-
|
Yup, this is a bug, filed as #813. I think the bug is exposed by changes in macOS 26.1. Either @eli-schwartz is correct in the analysis. The RPATH handling in meson-python has known shortcomings. There have been a couple of attempts at fixing it, see the open PRs. Unfortunately, some projects coming to depend on the buggy behavior. Fixing meson-python without breaking these projects requires some attention. I think I identified a way to do it, but I haven't been able to find time to push the required changes. The thing has been given low priority because nothing broke badly, so far. With this new problem exposed, I'll go back to working on it ASAP. |
Beta Was this translation helpful? Give feedback.
meson-python/mesonpy/_rpath.py
Lines 41 to 44 in 3c6b89d
It looks like mesonpy replaces each rpath with its own internal rpath, rather than removing the ones it doesn't want and adding a single instance of the internal rpath.
(mesonpy.libs indeed doesn't come from Meson itself -- it's added during wheel generation postprocessing.)