bazel-contrib / bazel-lib

Common useful functions for writing BUILD files and Starlark macros/rules
Apache License 2.0
139 stars 90 forks source link

No zstd toolchain provided for Windows - blocks usage of downstream rulesets (e.g. rules_oci) on Windows #964

Open jasonbdly opened 1 month ago

jasonbdly commented 1 month ago

I discovered this issue while attempting to adopt the rules_oci package for building container images.

In short, it looks like a Windows toolchain for zstd is not provided by this package, so any downstream rulesets that use zstd compression (such as for image layers) aren't functional on Windows: https://github.com/bazel-contrib/bazel-lib/blob/main/lib/private/zstd_toolchain.bzl#L31-L46

I noticed that the zstd-prebuilt repo doesn't attempt to build zstd for Windows at all: https://github.com/aspect-build/zstd-prebuilt/blob/main/BUILD.bazel#L3-L7

Is this something that could be supported, but there's some sort of blocker to providing that support? I'm just hoping to gain some context around this, enough that I could start poking around and hopefully submit a PR that adds that support.

thesayyn commented 1 month ago

zstd windows builds are non existent, last time i tried i could not get it to cross compile. We probably need to do something similar to https://github.com/aspect-build/bsdtar-prebuilt/pull/6 in https://github.com/aspect-build/zstd-prebuilt/tree/main

thesayyn commented 3 days ago

Okay now that i got a decent windows machine, i can look into this.

thesayyn commented 2 days ago

Okay i was able to build zstd on windows; https://github.com/bazelbuild/bazel-central-registry/pull/3237

PS C:\Users\Sahin\Documents\zstd-prebuilt> bazel-bin/external/zstd~/programs/zstd.exe
stdin is a console, aborting
thesayyn commented 2 days ago

Cool: i was able to successfully build this on CI: https://github.com/aspect-build/zstd-prebuilt/actions/runs/11961976398/job/33349361591?pr=1#step:3:70