Skip to content
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

ENH: support shared libraries on Windows when explicitly enabled #551

Merged
merged 5 commits into from
Feb 12, 2025

Conversation

dnicolodi
Copy link
Member

No description provided.

@dnicolodi dnicolodi force-pushed the shared-libs-win32 branch 5 times, most recently from d8e872a to 1778ab6 Compare December 9, 2023 20:00
@rgommers rgommers added the enhancement New feature or request label Dec 10, 2023
docs/reference/pyproject-settings.rst Outdated Show resolved Hide resolved
mesonpy/__init__.py Outdated Show resolved Hide resolved
mesonpy/__init__.py Outdated Show resolved Hide resolved
Copy link
Contributor

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

This looks like a good approach, I like it. A couple of thoughts:

  1. Internal shared libraries can be made to work today already in a package using meson-python, when explicitly installing the shared library without the package and using delvewheel (in an elaborate way) and install_rpath on other platforms, as demonstrated by BUG: Fix for scipy.special seterr, geterr, errstate scipy/scipy#20321. I think this PR is fine as is; I did have a concern that not having the option set shouldn't start raising an exception, so let's make sure that that remains the case.

  2. As @QuLogic commented, it'd be good to elaborate on the best ways for a package to do this. I think there are two:

@dnicolodi
Copy link
Member Author

dnicolodi commented Jan 29, 2025

With the documentation work done in #700 it is time to revisit this, I think. I think this PR is a good approach and the implementation is simple enough. However, I really don't like the option name I came up with. Does anyone have a better idea?

@rgommers
Copy link
Contributor

A good descriptive name is not so easy. Ideally the name should make clear it's a boolean and allows meson-python to fold internal shared libraries targeted for install outside site-packages into the wheel on Windows. That's too much info though. Although shared-libs-win32 can probably be improved on. Perhaps something like allow-windows-internal-sharedlib? (I don't like win32 much, since in wheel tags it's specific to 32-bit Python).

@dnicolodi dnicolodi mentioned this pull request Jan 31, 2025
@dnicolodi dnicolodi added this to the v0.18.0 milestone Feb 3, 2025
@dnicolodi
Copy link
Member Author

I've adjusted the option name and updated the documentation. Please have a look.

@dnicolodi dnicolodi force-pushed the shared-libs-win32 branch 2 times, most recently from de3234b to d7af1d7 Compare February 12, 2025 08:23
Copy link
Contributor

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

The added docs and the option name look quite good to me, as do the code changes.

The docs CI job has a complaint still. And it seems like test coverage still needs to be added.

mesonpy/__init__.py Outdated Show resolved Hide resolved
mesonpy/__init__.py Outdated Show resolved Hide resolved
mesonpy/__init__.py Outdated Show resolved Hide resolved
@dnicolodi dnicolodi force-pushed the shared-libs-win32 branch 9 times, most recently from e1a38a6 to 555bd6d Compare February 12, 2025 15:12
@dnicolodi
Copy link
Member Author

Thanks for the review @rgommers I didn't add tests because I didn't want to deal with compilation with MSVC... I added them and indeed I have no idea why MSVC complains during linking (there is an issue with an invalid linker argument that I'll fix, but that does not seem to be the cause of the link failure). Any help would be appreciated

@dnicolodi dnicolodi force-pushed the shared-libs-win32 branch 2 times, most recently from 41a2827 to 043657b Compare February 12, 2025 16:35
@dnicolodi
Copy link
Member Author

All green!

Copy link
Contributor

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

This looks good to go, nice work! Glad adding the test wasn't too much trouble.

One more docs suggestion inline.

One test suggestion here: the first commit and the FreeBSD patchelf addition show that RPATH handling works fine on FreeBSD now, so it may be nice to add freebsd to these lines in test_wheel.py:

@pytest.mark.skipif(sys.platform not in {'linux', 'darwin', 'sunos5'}, reason='Not supported on this platform')

Both of these are optional suggestions - happy for this to be merged as is if you prefer.

docs/reference/limitations.rst Outdated Show resolved Hide resolved
@dnicolodi
Copy link
Member Author

One test suggestion here: the first commit and the FreeBSD patchelf addition show that RPATH handling works fine on FreeBSD now, so it may be nice to add freebsd to these lines in test_wheel.py:

Indeed. I'll do

@dnicolodi dnicolodi merged commit 726aafc into mesonbuild:main Feb 12, 2025
42 checks passed
@rgommers
Copy link
Contributor

🎉 nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants