-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix regression when using both libraries #13835
Conversation
xclaesse
commented
Oct 29, 2024
•
edited
Loading
edited
2db860d
to
dd18985
Compare
dd18985
to
5b721a8
Compare
5b721a8
to
3a5b10b
Compare
3a5b10b
to
054689d
Compare
What happens if you have an explicitly static or shared use and you call It seems like I have something like: x = declare_dependency(link_with : both_libraries(...).as_shared())
y = x.as_static() y will have the library from x as static, even though I've explicitly declared that it's shared |
054689d
to
c1fa4c5
Compare
That's true. What's the desired behavior here is a bit debatable, but I think in any case that's a small price to pay compared to having to deal with BothLilbraries objects everywhere across the whole meson code base. I don't have an immediate idea to tackle this niche case. |
This partly reverts mesonbuild#12632 and provide an alternative implementation. The issue is we cannot propagate BothLibraries objects beyond the interpreter because it breaks many isinstance(obj, SharedLibrary) cases. Instead make SharedLibrary and StaticLibrary cross reference each other so we can take their brother library in as_static() and as_shared() methods.
c1fa4c5
to
36cd1ff
Compare
def extract_targets_as_list(self, kwargs: T.Dict[str, T.Union[LibTypes, T.Sequence[LibTypes]]], key: T.Literal['link_with', 'link_whole']) -> T.List[LibTypes]: | ||
bl_type = self.environment.coredata.get_option(OptionKey('default_both_libraries')) | ||
if bl_type == 'auto': | ||
bl_type = 'static' if isinstance(self, StaticLibrary) else 'shared' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, reading this again, my PR is wrong, it's not handling the "auto" case anymore. :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it in #13837
@@ -210,7 +210,7 @@ def _process_libs( | |||
if obj.found(): | |||
processed_libs += obj.get_link_args() | |||
processed_cflags += obj.get_compile_args() | |||
elif isinstance(obj, build.SharedLibrary) and obj.shared_library_only: | |||
elif isinstance(obj, build.SharedLibrary) and obj.static_library is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change brokes the test_as_link_whole
unit test
@xclaesse are we using this PR or the other PR? What's the story with getting this issue fixed? |
This PR is not ready and I don't have much time to polish it. I would say in the meantime the other fix could be good to have in 1.6.x because it fix at least a pretty important use-case. |
@xclaesse I think you missed the point that I rewrote #13837 based on what you tried to do here. It is no longer just a patch to fix the gnome module. |
#13837 was merged |