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

Dependency on default-features of a port not respected when dependency already installed #10678

Closed
Ghabry opened this issue Apr 3, 2020 · 10 comments
Assignees
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)

Comments

@Ghabry
Copy link
Contributor

Ghabry commented Apr 3, 2020

Describe the bug

When I install harfbuzz it always installs freetype with configuration [bzip2,core,png] even when I specify [core]. It seems that dependency resolution does not consider manual dependencies specified on command line.

Environment

  • Windows.
  • Version: e1fc03c. vcpkg_from_git: Add support for git over ssh

To Reproduce
Steps to reproduce the behavior:

  1. vcpkg.exe --triplet x86-windows install freetype[core] harfbuzz[core,ucdn]

Output:

  * bzip2[core]:x86-windows
    freetype[bzip2,core,png]:x86-windows
    harfbuzz[core,ucdn]:x86-windows
  * libpng[core]:x86-windows
  * ragel[core]:x86-windows
  * zlib[core]:x86-windows

Expected behavior

Only install freetype[core] packages:

Expected Output:

    freetype[core]:x86-windows
    harfbuzz[core,ucdn]:x86-windows
  * ragel[core]:x86-windows
  * zlib[core]:x86-windows
@LilyWangL
Copy link
Contributor

@Ghabry Thanks for posting this issue. When installing port[feature1], the VCPKG will install all default features + feature1. The related comments: #7471 (comment)

@Ghabry
Copy link
Contributor Author

Ghabry commented Apr 8, 2020

Thanks for the response.

Yeah I know about this feature behaviour without core (and it makes sense this way) but I explicitly specify core:

vcpkg.exe --triplet x86-windows install freetype[core] harfbuzz[core,ucdn]

Freetype is a dependency of harfbuzz. This installs bzip2 and libpng (default features of freetype) even though I specify freetype[core] here BUT when I do

vcpkg.exe --triplet x86-windows install freetype[core]
vcpkg.exe --triplet x86-windows install harfbuzz[core,ucdn]

it will not install bzip2 and libpng.

So imo this is a bug because the behaviour differs for the same package options.

@LilyWangL
Copy link
Contributor

I try to install harfbuzz[core,ucdn], the freetype will install freetype[bzip2,core,png] like this:

.\vcpkg.exe install harfbuzz[core,ucdn]
Computing installation plan...
The following packages will be built and installed:
  * freetype[bzip2,core,png]:x86-windows
    harfbuzz[core,ucdn]:x86-windows
  * ragel[core]:x86-windows
Additional packages (*) will be modified to complete this operation.
Starting package 1/3: freetype:x86-windows
Building package freetype[bzip2,core,png]:x86-windows...
-- Using cached E:/0325/vcpkg/downloads/freetype-2.10.1.tar.xz
-- Using source at E:/0325/vcpkg/buildtrees/freetype/src/2.10.1-ea10bbeefe
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Performing post-build validation
-- Performing post-build validation done
Building package freetype[bzip2,core,png]:x86-windows... done
Installing package freetype[bzip2,core,png]:x86-windows...
Installing package freetype[bzip2,core,png]:x86-windows... done
Elapsed time for package freetype:x86-windows: 23.76 s
......

@LilyWangL
Copy link
Contributor

Thanks for posting this issue. Please open a new issue if this is still a problem for you.

@carstene1ns
Copy link

So, this is a WontFix then?

@LilyWangL
Copy link
Contributor

When you install one port, the VCPKG will install it and its dependency port. The port implies all default features. Even if you specify freetype[core], but the harfbuzz will install freetype, the freetype implies freetype[bzip2,core,png].

@Ghabry
Copy link
Contributor Author

Ghabry commented Apr 29, 2020

I still believe this is a bug because the result differs.
But if you conclude that this is intended behaviour I can workaround it via the second solution.

Installing both at the same time, explicitly specifying freetype[core]:
Result: freetype[core] is fully ignored, installs freetype[bzip2,core,png]

> vcpkg.exe --triplet x86-windows install freetype[core] harfbuzz[core,ucdn]
Computing installation plan...
The following packages will be built and installed:
  * bzip2[core]:x86-windows
    freetype[bzip2,core,png]:x86-windows
    harfbuzz[core,ucdn]:x86-windows
  * libpng[core]:x86-windows
  * ragel[core]:x86-windows
  * zlib[core]:x86-windows

> vcpkg list
bzip2:x86-windows                                  1.0.6-5
freetype:x86-windows                               2.10.1-6
freetype[bzip2]:x86-windows
freetype[png]:x86-windows
harfbuzz:x86-windows                               2.5.3
harfbuzz[ucdn]:x86-windows 
libpng:x86-windows                                 1.6.37-7
ragel:x86-windows                                  6.10-3
zlib:x86-windows                                   1.2.11-6

Doing two invocations of vcpkg: harfbuzz is happy with freetype[core] and doesn't pull in libpng or bzip2.

> vcpkg.exe --triplet x86-windows install freetype[core]
Computing installation plan...
The following packages will be built and installed:
    freetype[core]:x86-windows
  * zlib[core]:x86-windows
  
> vcpkg.exe --triplet x86-windows install harfbuzz[core,ucdn]
Computing installation plan...
The following packages will be built and installed:
    harfbuzz[core,ucdn]:x86-windows
  * ragel[core]:x86-windows

> vcpkg list
freetype:x86-windows                               2.10.1-6
harfbuzz:x86-windows                               2.5.3
harfbuzz[ucdn]:x86-windows
ragel:x86-windows                                  6.10-3
zlib:x86-windows                                   1.2.11-6

@cbezault
Copy link
Contributor

There is a bug here but it isn't the one you originally described.
harfbuzz marks freetype without any features as a Build-Depends. This should cause freetype[core, bzip2, png] to get installed no matter what when you install harfbuzz. If harfbuzz is actually fine with just freetype's core features it should be marked as such in the CONTROL file.

The bug is that installing these two packages in two steps allows you to get freetype without its default features.

@cbezault cbezault reopened this Apr 29, 2020
@cbezault cbezault added category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) and removed category:question This issue is a question labels Apr 29, 2020
@cbezault cbezault changed the title Build dependencies always contain default features even when I specify [core] Dependency on default-features of a port not respected when dependency already installed Apr 29, 2020
@cbezault
Copy link
Contributor

Also thanks for the high-effort bug report. It's appreciated.

@Ghabry
Copy link
Contributor Author

Ghabry commented Apr 29, 2020

Ah so the bug is actually the inverse of what I thought.
Well what only matters is that the result is consistent :).

And thanks for the hint about the Build-Depends.

Changing harfbuzz to

Build-Depends: freetype[core], ragel, gettext (osx)

will give:

> vcpkg install harfbuzz[core,ucdn]
Computing installation plan...
The following packages will be built and installed:
  * bzip2[core]:x86-windows
  * freetype[bzip2,core,png]:x86-windows
    harfbuzz[core,ucdn]:x86-windows
  * libpng[core]:x86-windows
  * ragel[core]:x86-windows
  * zlib[core]:x86-windows

> vcpkg install freetype[core] harfbuzz[core,ucdn]
Computing installation plan...
The following packages will be built and installed:
    freetype[core]:x86-windows
    harfbuzz[core,ucdn]:x86-windows
  * ragel[core]:x86-windows
  * zlib[core]:x86-windows

Which is exactly what I would have expected. Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)
Projects
None yet
Development

No branches or pull requests

4 participants