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

Setting default-features with false does not work in a port's vcpkg.json #35555

Closed
BewareMyPower opened this issue Dec 8, 2023 · 4 comments
Closed
Assignees
Labels
category:question This issue is a question

Comments

@BewareMyPower
Copy link
Contributor

Describe the bug
I tried to contribute a new port and I'm testing it locally. In my project, the curl depends on openssl but in Vcpkg curl depends on sectransp by default on OSX. I tried setting "default-features": "false" but it does not work.

Environment

  • OS: macOS m1 Ventura 13.4.1
  • Compiler: revision

To Reproduce

Create port/xyz/vcpkg.json:

{
  "name": "xyz",
  "version": "1.0.0",
  "description": "...",
  "homepage": "https://github.com/microsoft/vcpkg-docs",
  "license": "Apache-2.0",
  "dependencies": [
    {
      "name": "vcpkg-cmake",
      "host": true
    },
    {
      "name": "vcpkg-cmake-config",
      "host": true
    },
    {
      "name": "curl",
      "default-features": false
    }
  ]
}

Then I ran vcpkg install xyz:

The following packages will be built and installed:
  * curl[core,non-http,sectransp,ssl]:arm64-osx -> 8.4.0
  * vcpkg-cmake:arm64-osx -> 2023-05-04
  * vcpkg-cmake-config:arm64-osx -> 2022-02-06#1
    xyz:arm64-osx -> 1.0.0
  * zlib:arm64-osx -> 1.3

As you can see, all the default features (core,non-http,sectransp,ssl) of curl were still installed.

Expected behavior
The default features should not be installed.

Failure logs
-(please attached failure logs)

Additional context

I tried a simple project with the similar vcpkg.json in manifest mode and it does not install the default features

@dg0yt
Copy link
Contributor

dg0yt commented Dec 8, 2023

Works as designed by the project owners.

The expected behaviour is supported for manifests in user projects.
But in a port, "default-features": false has a different meaning: It just enables control by the user, i.e.

  • If the user doesn't specify anything (in command line or user project manifest), vcpkg installs default features.
  • If the user specifies "default-features": false (in manifests) or [core] (in command line) for the respective port, the default features are no longer installed (unless required by another port).

@JonLiu1993 JonLiu1993 added the category:question This issue is a question label Dec 8, 2023
@BewareMyPower
Copy link
Contributor Author

I tried ./vcpkg install xyz[core] but still saw default features were installed.

% ./vcpkg install 'xyz[core]'                                                                                
Computing installation plan...
The following packages will be built and installed:
  * curl[core,non-http,sectransp,ssl]:arm64-osx -> 8.4.0
  * vcpkg-cmake:arm64-osx -> 2023-05-04
  * vcpkg-cmake-config:arm64-osx -> 2022-02-06#1
    xyz:arm64-osx -> 1.0.0
  * zlib:arm64-osx -> 1.3

Is there any way to avoid installing default features of curl?

@dg0yt
Copy link
Contributor

dg0yt commented Dec 8, 2023

I tried ./vcpkg install xyz[core] but still saw default features were installed.

Your command line ("user") didn't specify anything about curl. What you need is:

./vcpkg install xyz curl[core]

The effect of curl[core] is what is enabled by xyz's vcpkg.json. If it hadn't "default-features": false for curl, it would depend on the default features.

@BewareMyPower
Copy link
Contributor Author

Thanks for your explanation. It now works:

% ./vcpkg install xyz 'curl[core]'                                                                           
Computing installation plan...
The following packages will be built and installed:
    curl:arm64-osx -> 8.4.0
  * vcpkg-cmake:arm64-osx -> 2023-05-04
  * vcpkg-cmake-config:arm64-osx -> 2022-02-06#1
    xyz:arm64-osx -> 1.0.0
  * zlib:arm64-osx -> 1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

3 participants