-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
'"default-features": false' doesn't work with a dependency of a dependency(transitive dependency) #26664
Comments
Sorry, I edited the bug description. "on that another package is dependent" wasn't really needed. It's simply "when it's in vcpkg.json of a package that's a dependency of my project". |
IIRC you have to explicitly add a |
When my project uses A and A depends on B, I need to control B's features in my project's vcpkg.json? |
Yes. Your project's manifest is the ultimate control if you don't want default features. |
I'm afraid but my issue is that the "default-feature" statement is ignored while declared. There still seems being a problem even if that method works on controlling dependencies. |
The |
|
I think this would be a bug of vcpkg tool rather than portfiles. |
@fujiinzukaatusi You should start with reading more existing issues and PRs (incl. PRs in vcpkg-tool repo). |
It is never ignored, but it works somewhat different than expected by the uninitiated. For a port
The ports' manifests work like this:
It is not like all of us are happy with this. Even less with regard to host dependencies. |
Do you mean I need more steps than only setting |
The specific In manifest mode, you must declare |
You mean:
Right? |
Yes. 👍 If A can be used with B[core], but lacks |
OK, I finally understand. Very thanks! |
Should I open new issue for this? |
Just to chime in, I was really confused by this was well. Using the previous example MyProj > A > B, I would never have expected to need to specify features for project B (a transitive dependency.) How A specifies within its manifest to use B should be used for all downstream projects. It makes me concerned that I have to copy paste the entire transitive dependency tree in my own project's manifest just to ensure I have the correct dependencies as each library author intended. Similarly, I as a library author should be able to specify the configuration of a dependency that anyone using my lib will get. If I specify This seems strictly incorrect to me. |
@pragmaxwell Indeed. Not only that this is confusing and superfluously complicated, but not documented or announced in any place. Most of users and even library authors may not know about. |
I just fell into the same trap. I was trying to opt-out of some default features in a dependency to reduce build size. I set In classic mode I have to call I agree that this is confusing and complicated. Is it really intended, that i need to keep track of all my transitive dependencies and replicate them in my command/manifest? This seems utterly redundant and prone for errors. Why not just collect the minimum set of features and install the dependency using that. If someone really wants the default features they can add the package to the commandline/manifest. It seems the current implementation is exactly the opposite of what people would expect. |
I really wonder why no one gives any answer or even hint to this question. Actually it seems like neglected. |
The default features should reflect what upstream recommends, what most users want, and what should be tested best. |
The default features may be so. I thought we've been discussing to avoid installing default features and get only core feature. |
I don't get the point of this line. I would be happy if opting out could be done by a global switch. But that's another story. There is work in progress, but it seems to need more patience than advertising: microsoft/vcpkg-tool#538, microsoft/vcpkg-tool#177. |
What I asked for is the reason why vcpkg basically installs default features of transitive dependencies even if defined it should get only core feature in manifests. The problem is not whether we can manually opt out them or not. It's good there's such PR in progress, although I rather think it should be the default behaviour without switching. So could I recognise the PR is now not implemented due to technical or resource matters not any design reason? |
I think this is a misunderstanding. In port manifests, |
I'm sure to already understand the current implementation. The question is why |
Because Gentoo's |
If you want to install only core, there's the two requirements. Even if |
But take this dependency path,
But The |
@fujiinzukaatusi Also thank you for the clarification, advices, and suggestions |
@silverqx No worries. Just in case you still have got a question I'll leave the answer. 1."Isn't this behaviour a bug?" Actually I'm now using Conan instead and won't return back to vcpkg anymore until this problem gets solved. |
I think that it's unfinished only, what is really bad is that the whole
It looks like it will never be merged, I looked at this.
The biggest problem is that vcpkg
Noo, I don't know how to code in Is also |
The most important thing wasn't mentioned AFAICS: listing
(Edit, addition: Listing
It is not really ignored, but in port manifests it has different semantics: To enable control in user (application) manifest. The port author can signal that he really verified the minimal set of required features. If the user doesn't make explicitly declarations, the default remains to install the default features. |
I also understand it this way and I've been using the
Yeah, that is exactly how it is working, I still don't know if this is good or bad. What if the library or executable depends on a really deep graph with 100 dependencies, eg. 15 direct dependencies and these dependencies depend on another and another dependencies eg. 5 level deep, how the user can control this in his manifest that is unreal.
Unintelligible, I don't understand what you wrote. |
Even if it's unintelligible I think I know what you are talking about and it's this:
Because of that the So even if the user/consumer states that he wants |
As you can see is not simple to think about this and even harder to write about it, it's not a piece of cake. |
Indeed. Exactly.
Probably they mean Yes, thanks. Then would you mean to keep occasionally emerging and explain this behaviour each time someone who's confused appears? |
This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment. |
This issue is not stale. Remove the label. |
I have another question related to this and I need a little help. All the following is classic mode related only. But what about the If I invoke the I'm currently deleting the Thx for suggestions and advices. |
ok, thx |
Do you know how this problem relates to vcpkg manifest mode? What if I have installed some older version in manifest mode and then do git pull on the vcpkg repo and then try rebuild the project, vcpkg manifest mode calls the vcpkg install only internally, there is not vcpkg upgrade in manifest mode right?, how it picks newer versions and they features? |
I can't tell without testing, I would have to test this to verify it. |
I can't tell without testing, but another run in manifest mode is more likely another equivalent to an explicit x-set-installed, not an equivalent to the upgrade command. |
I understand it this way too. Would be good to test it if it works correctly but I have too much work and I never noticed any problems related to this, I'm using manifest mode a lot. |
Is there any fix for this? I need to disable the |
@nadiaholmquist Solve it as designed: Add |
That doesn't actually work, adding pcre2 to the project's manifest with default-features off gets it compiled with JIT anyway. |
Then we need to find the ports in your installed set which depend on |
Well, almost all dowstream ports depend on default features here. (There was no such controlling feature until May 2023.) |
Describe the bug
"default-features": false
doesn't work when it's in vcpkg.json of a package that's a dependency of my project.Edit:
For those who got to this issue, here's a summery.
Below is vcpkg.json of my projcet.
"plugins" feature of osg package uses full features of gdal package. I changed osg's vcpkg.json to use only gdal's core feature.
Below is an extract of it.
Then I ran
vcpkg install --triplet x64-windows-static --dry-run
. I expected in the installation list gdal package containing only[core]
feature.But I got this:
Environment
To Reproduce
See Describe the bug.
Expected behavior
See Describe the bug.
Failure logs
None.
Additional context
I already confirmed:
The text was updated successfully, but these errors were encountered: