Skip to content

Platform expressions cannot express "when the host is Windows" for host dependencies #2060

Description

@omartijn

Ports whose Windows build needs a host-only helper (e.g. vcpkg-msbuild, which has "supports": "native & windows") have no correct platform expression for that dependency:

  • "platform": "windows & !mingw" is evaluated against the target triplet, so cross-compiling e.g. libsodium:x64-windows from a Linux host fails during planning with "vcpkg-msbuild is only supported on 'native & windows', which does not match x64-linux" — even when the port would take a non-msbuild code path for that build.
  • "platform": "windows & !mingw & native" fixes cross resolution, but native compares triplet names, so any Windows triplet named differently from the host triplet regresses: libsodium:x64-windows-static on an x64-windows host is not native, the dependency is dropped, and the msbuild path fails. See the review discussion in [libsodium] support non-MSVC compilers on Windows via the make-based … vcpkg#52803, where exactly this trade-off came up.

What seems to be missing is a way to express "this dependency is needed when the host can run it / is Windows". Possible directions:

  • evaluate the platform expression of "host": true dependencies against the host triplet instead of the target triplet (arguably the intuitive semantics, but a behavior change);
  • or add a host-context predicate to platform expressions (e.g. host_windows, or a general $host(...) context).

The workaround today is --allow-unsupported, which turns a targeted constraint into a blunt instrument for the whole install plan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions