Skip to content

Extend INSTALL_RPATH to include parent directories #57

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

Merged
merged 2 commits into from
Apr 7, 2025

Conversation

ekomarova
Copy link
Collaborator

This PR updates the INSTALL_RPATH for the _ufuncs target on Unix systems to improve runtime discovery of dependent shared libraries such as libintlc.so.5 (IntelPython/mkl_fft#146).
In recent builds (e.g., mkl_umath 0.1.4), users encountered runtime errors like:

ImportError: libintlc.so.5: cannot open shared object file: No such file or directory

Although the library was bundled with the wheel, it could not be located at runtime due to limited RPATH configuration.
The updated INSTALL_RPATH now includes additional parent directories. This allows the dynamic linker to resolve libraries located in upper-level paths relative to the extension module.

This change ensures that shared libraries located in $ORIGIN, $ORIGIN/../.., and $ORIGIN/../../.. are discoverable at runtime, improving robustness in environments where dependent libraries may be installed outside the immediate directory
@ekomarova ekomarova self-assigned this Apr 7, 2025
@ekomarova
Copy link
Collaborator Author

ekomarova commented Apr 7, 2025

@vtavana I wanted to ask you if it makes sense to update this as well https://github.com/IntelPython/mkl_umath/blob/main/CMakeLists.txt#L143?
And I will need to test this change as well, since I do not know if it will have an effect or not (I hope yes 🤗)

@vtavana
Copy link
Collaborator

vtavana commented Apr 7, 2025

@vtavana I wanted to ask you if it makes sense to update this as well https://github.com/IntelPython/mkl_umath/blob/main/CMakeLists.txt#L143? And I will need to test this change as well, since I do not know if it will have an effect or not (I hope yes 🤗)

Yes, I believe you have to do the same here for _patch.

@ekomarova
Copy link
Collaborator Author

I'm going to test this change in the wheel. I'll let you know as soon as the results are available

@ekomarova
Copy link
Collaborator Author

ekomarova commented Apr 7, 2025

@ndgrigorian confirmed that the wheel built with this change is working correctly. I think we can merge this and create a new release. I also managed to install the package locally and reproduce the scenario, it works:

>> python -m venv umath_014_v2
>> source umath_014_v2/bin/activate
>> pip install --no-cache-dir mkl_umath-0.1.4-5-cp312-cp312-manylinux_2_28_x86_64.whl
>> python
Python 3.12.9 | packaged by conda-forge | (main, Mar  4 2025, 22:48:41) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mkl_umath
>>>

@ekomarova
Copy link
Collaborator Author

Please review

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, resolves the issue when I tested with Python 3.11 and 3.12

@ndgrigorian ndgrigorian merged commit f3a09f9 into main Apr 7, 2025
12 checks passed
@ndgrigorian ndgrigorian deleted the extend-install-path branch April 7, 2025 18:37
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.

None yet

4 participants