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

Indirectly referenced library will always be installed with default features even if they're not required #17033

Closed
xuhongxu96 opened this issue Apr 2, 2021 · 3 comments
Assignees
Labels
category:question This issue is a question

Comments

@xuhongxu96
Copy link
Contributor

Describe the bug
I have a libA referencing libB using manifest vcpkg.json:

{
    "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
    "name": "libA",
    "version": "0.1",
    "dependencies": ["libB"]
}

And libB references libzip[core]. libB's vcpkg.json (in my custom ports overlay) is:

{
    "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
    "name": "libB",
    "version": "0.1",
    "dependencies": [
        {
            "name": "libzip",
            "default-features": false
        }
    ]
}

When I use vcpkg install --feature-flags=manifests in libA's directory, it will install libzip with default features instead of [core].

For now, I have to workaround by changing my libA's vcpkg.json to:

{
    "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
    "name": "libA",
    "version": "0.1",
    "dependencies": [
        "libB",
        {
            "name": "libzip",
            "default-features": false
        }
    ]
}

Environment

  • OS: All
  • Compiler: Any

Expected behavior

If libzip is not installed already, it should be installed with the required features only.

@xuhongxu96 xuhongxu96 changed the title Indirectly referenced library will always be installed with default features Indirectly referenced library will always be installed with default features even if they're not required Apr 2, 2021
@NancyLi1013 NancyLi1013 added the info:manifests This PR or Issue pertains to the Manifests feature label Apr 2, 2021
@PhoebeHui PhoebeHui added the category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) label Apr 2, 2021
@PhoebeHui
Copy link
Contributor

We have discussed the similar behavior before, see PR #11602, this seems intentional behavior, @strega-nil, could you help confirm this issue?

@strega-nil
Copy link
Contributor

Yeah, this is intentional. In the "classic mode" world, it makes sense to always install default features, so that we don't have to keep rebuilding libraries. In "manifest mode", it can make sense to not do that, since we don't have an install-set that is not described by manifests.

@JonLiu1993
Copy link
Member

JonLiu1993 commented Jun 8, 2022

I'm closing this issue because all behaviors described in this thread are by design, please see the discussion in pr #11602 about the rationale.
liba:

{
    "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
    "name": "liba",
    "version": "0.1",
    "dependencies": ["sqlite3"]
}

libb:

{
    "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
    "name": "sqlite3",
    "version": "0.1",
    "dependencies": [
        {
            "name": "libzip",
            "default-features": false
        }
    ]
}
PS F:\Feature-test\test\vcpkg\libA\vcpkg> ./vcpkg install --feature-flags=manifests
Detecting compiler hash for triplet x64-windows...
A suitable version of powershell-core was not found (required v7.2.3). Downloading portable powershell-core v7.2.3...
Downloading powershell-core...
  https:/PowerShell/PowerShell/releases/download/v7.2.3/PowerShell-7.2.3-win-x86.zip -> F:\Feature-test\test\vcpkg\libA\vcpkg\downloads\PowerShell-7.2.3-win-x86.zip
Extracting powershell-core...
Detecting compiler hash for triplet x86-windows...
The following packages will be built and installed:
    sqlite3[core]:x86-windows -> 3.37.2#1
  * vcpkg-cmake[core]:x64-windows -> 2022-05-10#1
  * vcpkg-cmake-config[core]:x64-windows -> 2022-02-06#1

Changing liba's vcpkg.json to:

{
    "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
    "name": "liba",
    "version": "0.1",
    "dependencies": [
        "sqlite3",
        {
            "name": "libzip",
            "default-features": false
        }
    ]
}
PS F:\Feature-test\test\vcpkg\libA\vcpkg> ./vcpkg install --feature-flags=manifests
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows...
The following packages will be built and installed:
    libzip[core]:x86-windows -> 1.8.0
  * zlib[core]:x86-windows -> 1.2.12#1

@JonLiu1993 JonLiu1993 added category:question This issue is a question and removed category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) info:manifests This PR or Issue pertains to the Manifests feature labels Jun 8, 2022
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

5 participants