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

vcpkg ignores default-features: false #31290

Closed
Thomas1664 opened this issue May 6, 2023 · 7 comments
Closed

vcpkg ignores default-features: false #31290

Thomas1664 opened this issue May 6, 2023 · 7 comments

Comments

@Thomas1664
Copy link
Contributor

Describe the bug

It seems like vcpkg does not respect default-features: false in transitive dependencies. Consequently, vcpkg installs unwanted features.

Environment

  • OS: Windows 10
  • Compiler: not relevant
  • vcpkg version: 2023-04-07-bedcba5172f5e4b91caac660ab7afe92c27a9895
  • vcpkg ports commit: 6a3dd08

To Reproduce

Steps to reproduce the behavior:

  1. ./vcpkg depend-info glib
  • Only pcre2 depends on bzip2.
  • Although pcre2 has disabled default features for bzip2, the feature tool is still selected.

Expected behavior
To not select bzip2[tool].

Failure logs

vcpkg-cmake: 
vcpkg-cmake-config:
bzip2[tool]: vcpkg-cmake, vcpkg-cmake-config
libiconv:
zlib: vcpkg-cmake
dirent:
gettext: libiconv
libffi: vcpkg-cmake, vcpkg-cmake-config
pcre2: bzip2, vcpkg-cmake, vcpkg-cmake-config, zlib
vcpkg-tool-meson:
glib: dirent, gettext, libffi, libiconv, pcre2, vcpkg-tool-meson, zlib
@autoantwort
Copy link
Contributor

Duplicate of #31230

@Thomas1664
Copy link
Contributor Author

Duplicate of #31230

Didn't find it because it was only category:question. But this is a bug, right? If I'd have to specify in my manifest that I don't want the default features of a transitive dependency, default-features: false doesn't make any sense.

@autoantwort
Copy link
Contributor

But this is a bug, right?

No this is by design.

If I'd have to specify in my manifest that I don't want the default features of a transitive dependency, default-features: false doesn't make any sense.

It still makes sense. Otherwise would be not able to disable the tool feature of bzip2 at all. So by default "xyz" in a manifest means xyz[defaults] and with default-features: false it means xyz[core] so default features can be disabled by the top level/users manifest.

@Thomas1664
Copy link
Contributor Author

Let me clarify: It doesn't make sense to put default-features: false in a port in the catalogue if default features are selected anyway.

@autoantwort
Copy link
Contributor

It still makes sense. Otherwise would be not able to disable the tool feature of bzip2 at all. So by default "xyz" in a manifest means xyz[defaults] and with default-features: false it means xyz[core] so default features can be disabled by the top level/users manifest.

Example:
Port B exits with a default feature def.
Port A depends on B.
You install A and B[core] => You get A[core] and B[core,def]

Now you use default-features: false in a port in the catalogue (in this example B)
Port B exits with a default feature def.
Port A depends on B[core].
You install A and B[core] => You get A[core] and B[core]

@Thomas1664
Copy link
Contributor Author

I don't think it has to do with transitive dependencies. Lets use real ports. In my example, I tried to install glib. glib depends on pcre2. pcre2 depends on bzip2 and uses default-features: false to get rid of bzip2[tool]. Even if I install pcre2, I get bzip2[tool].

This is the output of vcpkg depend-info pcre2:

vcpkg-cmake: 
vcpkg-cmake-config:
bzip2[tool]: vcpkg-cmake, vcpkg-cmake-config
zlib: vcpkg-cmake
pcre2: bzip2, vcpkg-cmake, vcpkg-cmake-config, zlib

Now I remove default-features: false in pcre2 for the bzip2 dependency. The output of vcpkg depend-info pcre2 stays the same. But when I try vcpkg install pcre2 bzip2[core] it still includes the tool feature. This doesn't happen anymore if I'd restore default-features: false.

I understand the need for default-features: false now. However, this does not explain why vcpkg install pcre2 has to include bzip2[tool]. If one port disables a default feature and no other port needs that feature, what is the point of ignoring the fact that the feature was explicitly disabled?

@autoantwort
Copy link
Contributor

If one port disables a default feature and no other port needs that feature, what is the point of ignoring the fact that the feature was explicitly disabled?

You can follow one of the many discussions about that here: #26664 (comment)
It is a design decision that was done in the past. I don't want to discuss it again.

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

No branches or pull requests

2 participants