Fix regression in Requires.private for library(), and difference wrt shared_library()#15691
Open
bonzini wants to merge 5 commits intomesonbuild:masterfrom
Open
Fix regression in Requires.private for library(), and difference wrt shared_library()#15691bonzini wants to merge 5 commits intomesonbuild:masterfrom
Requires.private for library(), and difference wrt shared_library()#15691bonzini wants to merge 5 commits intomesonbuild:masterfrom
Conversation
992a26d to
fcf6a2c
Compare
d1f51f3 to
4d592d8
Compare
nirbheek
reviewed
Apr 7, 2026
| when `pkg-config` or `pkgconf` are invoked with `--cflags`. Previously, | ||
| the line was included for shared libraries created with `library` (even | ||
| if the `default_library` option was set to `shared`), whereas now | ||
| `library` and `shared_library` behave in the same way. |
Member
There was a problem hiding this comment.
I think this note needs to make it clearer that this is a bugfix only for shared_library(). The wording right now makes it seem like Meson was always generating incorrect pc files for shared libraries, but (IIUC) that was not the case for library() with default_library=shared?
Member
|
FWIW, this was the original PR that added the It seems that back then there was vigorous debate about whether this should be done or not. I think we should split out the "difference wrt shared_library()" part of this PR out, it has the potential to break stuff. |
This reverts commit be99ec0, so that a proper solution can be included in 1.12.
…vate test_usage_pkgconfig_prefixes works only because one of the shared_libraries is not specifying a Requires.private for its dependent. Fix it so that it keeps working after the Requires.private (which is already present for library()) is added. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
…ared library Ensure that when a `.pc` file is created for a shared library, its `Requires.private` line now always includes the dependencies of the shared library. Until Meson 1.11-rc2, the line was included for shared libraries created with `library`, because those were created with shared_library_only=False; commit 6519dd4 ("interpreter: set shared_library_only within build_target", 2026-04-02) made `shared_library` and `library` behave the same way. Unfortunately the behavior corresponding to `shared_library_only=True` was the wrong one. For the shared_library_only case link_with and link_whole libraries are irrelevant but external dependencies are relevant. Fixes: 6519dd4 ("interpreter: set shared_library_only within build_target", 2026-04-02) Fixes: mesonbuild#15690 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
…uires.private When generating .pc files for shared libraries, Meson automatically adds Requires.private entries for the library's dependencies (so that pkg-config --cflags works correctly). However, this can pull in unnecessary build dependencies when the library's public headers do not actually expose its dependency's headers. Add a new requires_shared keyword argument that, when specified, replaces the automatic Requires.private entries for shared libraries with a user-provided list. Passing an empty list suppresses the automatic entries entirely.
4d592d8 to
040219b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ensure that when a
.pcfile is created for a shared library, itsRequires.privateline now always includes the dependencies of theshared library. Until Meson 1.11-rc2, the line was included for
shared libraries created with
library, because those were createdwith shared_library_only=False; commit 6519dd4 ("interpreter:
set shared_library_only within build_target", 2026-04-02) made
shared_libraryandlibrarybehave the same way.Unfortunately the behavior corresponding to
shared_library_only=Truewas the wrong one. For the
shared_library_onlycase,link_withandlink_wholelibraries are irrelevant but external dependencies are relevant indeed.Overall this is a bugfix because the
Requires.privatelines was absent forshared_library.Fixes: #15690