buildbuddy-io / buildbuddy-toolchain

Bazel toolchains for BuildBuddy RBE
MIT License
12 stars 12 forks source link

windows: initial windows toolchain #23

Closed sluongng closed 4 months ago

sluongng commented 4 months ago

Derived a Windows toolchain from Bazel's auto-generated local Windows toolchain.

The default values are derived from my self-hosted Executor right now, which uses a VM image downloaded from https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/.

sluongng commented 4 months ago

This current setup works with Host, Exec, Target == Windows.

However when I tried Host == MacOS and Exec, Target == Windows, I got this weird command args from Bazel https://app.buildbuddy.io/invocation/4ffc9fcc-3f8c-456b-b998-750e395d8190#execution

Not sure yet how to fix this.

fmeum commented 4 months ago

However when I tried Host == MacOS and Exec, Target == Windows, I got this weird command args from Bazel https://app.buildbuddy.io/invocation/4ffc9fcc-3f8c-456b-b998-750e395d8190#execution

That's because PathFragment normalization in Bazel depends on the host OS and on macOS C:/foo/bar/whatever is considered a relative path. You could try using the Cygwin /c/foo/bar/whatever notation instead. If that doesn't work, we may need wrappers around the compiler tools that translate a relative path into the corresponding absolute path.

We should also do something about this in Bazel. Could you file an issue?

sluongng commented 4 months ago

@fmeum filed in https://github.com/bazelbuild/bazel/issues/22169

sluongng commented 4 months ago

You could try using the Cygwin /c/foo/bar/whatever notation instead.

We can provide a separate toolchain for Cygwin / Msys2 in a subsequent PR.

Right now this would not work because our Executor will be running in Powershell and use Go os/exec to execute the RE Command. This requires us to use Windows path. I have yet to test our Executor with Cygwin and Msys2 (or using toolchains that come from those shell env). I suspect demands for them would be relatively smaller vs Microsoft Visual Studio toolchain though.

If that doesn't work, we may need wrappers around the compiler tools that translate a relative path into the corresponding absolute path.

This is a neat idea. It would unblock us instead of having to wait for https://github.com/bazelbuild/bazel/issues/19208 to get fixed on the Bazel side 🤔

Let's do this in the next PR.

sluongng commented 4 months ago

Turn out that even with a wrapper, we need to handle external/buildbuddy_toolchain/<wrapper_relative_path>. So let's wait for the fix on the Bazel side for now.