NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.37k stars 13.6k forks source link

vcpkg: Linux arm64 requires VCPKG_FORCE_SYSTEM_BINARIES #335868

Open gracicot opened 3 weeks ago

gracicot commented 3 weeks ago

Describe the bug

A clear and concise description of what the bug is.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Use nixos on arm
  2. Open a shell with vcpkg: nix run nixpkgs#vcpkg
  3. Run vcpkg
  4. See the error message Environment variable VCPKG_FORCE_SYSTEM_BINARIES must be set on arm, s390x, ppc64le and riscv platforms.

Expected behavior

No error should happen, the help output should be shown.

Additional context

Suspected to be since the last refactor of the wrapper script (#323866), but could have been a problem since before that.

I think this environment variable should always be set from the wrapper script unconditionally.

Notify maintainers

@Guekka @h7x4 @gracicot

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-linux"`
 - host os: `Linux 6.8.0-31-generic`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.24.3`
 - channels(root): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Add a :+1: reaction to issues you find important.

Guekka commented 3 weeks ago

Is this really an issue? From the error message, I suppose it also happens with the official binaries and it has to be set by the user?

gracicot commented 3 weeks ago

@Guekka hmm, this is a good point. Maybe it is intended behaviour then. However, in the case of x86, I think vcpkg will download binaries meant for a normal linux distribution and those binaries will fail to run. If that's the case, then we need to ensure vcpkg will always pick system binaries. I'll try to find some time to investigate.

h7x4 commented 3 weeks ago

AFAIK, this is something that happens normally as well (but I might be wrong, I can't remember having tested it). I think it's something to keep in mind for #330859, but I'm not sure about setting it in the wrapper. If we do set it, we should at least provide some sort of option to opt back to default behaviour.

However, I don't really see how you would use vcpkg if you don't set it? Maybe we should look through some of the vcpkg history, to see if there's a good reason they don't make it the default when cross compiling?

Guekka commented 3 weeks ago

It comes from here https://github.com/microsoft/vcpkg-tool/commit/e379c8edcf231c8d0bd1fc7e8962ac1710b381d7