Conversation
3c3bcf5 to
f84c84f
Compare
54c1583 to
21c079d
Compare
|
This should fix RPATH handling for good. The only thing not included is automatic translation of the There is one case in which this may break projects that work now: when libraries or modules require setting an RPATH to dynamically link to a library installed in the Python install path (with something like @rgommers I think I added test cases for all scenarios we discussed. It would be great if you could test with packages that may be affected and that do not pin the meson-python version to any released version. |
87b4cee to
1fa120b
Compare
There is no need to perform the check for every native file installed.
for packages using internal shared libraries relocated by meson-python. Fixes mesonbuild#711.
Revise tests to exercise support when executed with Meson > 1.6
Requires Meson 1.9.0.
Emit a warning when this is done. This is required to keep some backward compatibility with packages that relied on the incomplete RPATH handling behavior before mesonbuild#788 to work.
The tests package builds an extension module that links with two libraries, one installed alongside the extension module, and another installed in a sub-directory. The location of both libraries needs to be added to the RPATH. The test requires install_rpath support and thus Meson version 1.6 or later for install_rpath to be recorded in the metadata. Ignore the warning emitted building the package on macOS due to the '$ORIGIN' to '@loader_path' translation.
cbf3d45 to
74ad638
Compare
|
There is a failure in the pixi test job: I don't know where the extra RPATH entry comes from. I suspect that it is something that the build environment adds but I don't know why or where, nor what would be a good way to control for it in the test. |
It comes from the |
43c5274 to
ad4c9b5
Compare
ad4c9b5 to
d323a1e
Compare
To get support for *, /, and % operators in Meson code. See pygments/pygments#2918. Remove relative work-around.
Warn that the translation of $ORIGIN into @loader_path on macOS is provided only for backward compatibility and it is discouraged to rely on it.
Done. |
|
Thanks for the updates!
Yes indeed. For a very long time, conda-forge set Setting those env vars led to a lot of unwanted side effects (e.g., the I believe Homebrew uses spec files too. As do Linux distros in general, but there you typically don't notice because the system loader already has the right search paths, so you don't need extra RPATHs set in spec files. Nix/Spack use compiler wrapper scripts instead; all achieve the same end result of adding an RPATH when invoking a compiler. In all those cases: you can get extra RPATH entries from a compiler invocation, and that may or may not be observable from either I think the takeaway is that we can test:
|
|
|
||
| def rpath_from_sysconfig_ldflags(): | ||
| # Account for extra RPATH entries added by compilation flags in | ||
| # the Python configuration. This is required for conda/pixi. |
There was a problem hiding this comment.
Flags from sysconfig never propagate, that's a setuptools-only behavior, so this might be misleading. For conda/pixi, it's (used to be) the environment variable LDFLAGS , which only happens to match sysconfig.get_config_var('LDFLAGS'), but that isn't guaranteed and will no longer be true if python gets rebuilt with "minimally activated compilers".
More importantly, we can't reliably know if extra RPATHs are valid or not, we only know when they're invalid (a build/destdir path or something we added ourselves in a test package).
There was a problem hiding this comment.
In our own CI we could assert an exact set, because we have control over that. So if we want something like that, like assert rpaths == set(expected, extra_from_conda_env_or_compiler), we can - but it should then be gated on something like MESONPY_CI_ONLY.
There was a problem hiding this comment.
Flags from
sysconfignever propagate
I know. This is just an hack to get to what the pkgconfig contains hoping that it stays in sync with what is in sysconfig. I don't like this either, but I wanted to keep the tests as strict as possible and I was unable to come up with a nicer solution.
There was a problem hiding this comment.
I don't think keeping the test strict is essential, but if you do want that, then I think it's correct to read os.environ['LDFLAGS']. The current sysconfig.get_config_var('LDFLAGS') happens to match today, but I expect it to start diverging as soon as conda-forge's python is rebuilt with the minimally activated compilers.
There was a problem hiding this comment.
os.environ['LDFLAGS'] is the first thing I tried, but it is not set.
|
Some of the most relevant docs/discussion/code:
|
Uhm. I wonder how the RPATH tests work without the |
Checking that the build paths are not present requires computing the build rpaths, which is not always straightforward. Furthermore, sometimes the build paths are the same as the expected rpaths, making the things even more complex. I think we can assume that any rpath added by the build environment is an absolute path. Thus we can simply filter these out and keep testing that only the expected rpaths are there. What do you think? |
That code I linked is Homebrew on Linux, in a function named
That seems like a good approach for the test suite. I'd make one addition: before filtering out absolute paths, reject any that point into the source or build directory. We should always be able to know those: the build directory is either explicitly supplied by Of course there may be a test that explicitly adds I'll note that I was just polishing a test package for path ordering and (lack of) duplicates, so we can't only compare sets in general. I hope to finish that later today. |
Right. I didn't pay attention.
This seems like a good approach. This can be extended to check for duplicates at the same time. I'll see how complex it is too do this.
There are just two tests that strictly check all rpath entries. I don't think it is necessary to extend it to all tests. The other tests are builds of the same package which add some rpaths via env vars or command line flags. |
Builds on top of #783 and replaces #724
Fixes #711
Fixes #813