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

Bazel can build different tools on different execution platforms in the same build #11748

Closed
gregestren opened this issue Jul 10, 2020 · 8 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Configurability Issues for Configurability team type: feature request

Comments

@gregestren
Copy link
Contributor

For example, building on a Mac where some tools execute on the Mac and others execute on a remote Linux machine.

This tracks a Blaze configurability roadmap effort.

@sdtwigg sdtwigg added P1 I'll work on this now. (Assignee required) and removed untriaged labels Jul 17, 2020
@cpsauer
Copy link
Contributor

cpsauer commented Sep 16, 2020

Came across this looking to build and bundle together binaries, one for each platform, some of which would need to get built remotely. This would be awesome for that!

Could I ask what use case originally inspired this feature request?

Also, @gregestren: I was just building on some of your great examples around transitions. Thank you for those!

@katre
Copy link
Member

katre commented Sep 16, 2020

We have mixed-backend builds we'd like to do, mostly around developers who are working on Mac laptops but want to use the Linux remote build backends, so we'd like to get that moving. There's a lot of cruft to clean up first, though, so I'm not sure when we'll be moving forward.

Mixed binaries like you want can be done with transitions, however, so I am glad you found the examples for those helpful.

@ulfjack
Copy link
Contributor

ulfjack commented Sep 16, 2020

We have successfully run some builds where Bazel runs on a Mac and the build runs on Linux, although that required a patch to the bazel-toolchains repository which currently looks at the local host to determine the remote host (which is obviously incorrect in this case).

@cpsauer
Copy link
Contributor

cpsauer commented Sep 17, 2020

Thanks, both of you, for replying.

@katre, just to confirm, I can't currently use transitions to have parts of the graph build remotely, right? That's what it seemed like from my experience playing around with transitions, and this seemed like the issue that would lead to the change from reading the design doc (link if anyone else is looking). But your comment seemed to say otherwise? Just to make it concrete: imagine building on a Mac, where you can locally (cross)compile the binary for macOS, iOS, Android (using transitions), but want to compile for Windows, Linux remotely. Or equivalently compiling from Linux, able to build for Linux, Android locally, but needing to compile for iOS, macOS, Windows remotely.

@ulfjack
Copy link
Contributor

ulfjack commented Sep 18, 2020

@cpsauer, even if you could, the code still has other problems. In particular, it looks at the OS that Bazel runs on to select things like path style (windows with backslashes vs. linux/mac with forward slashes). Right now, even running Windows actions remotely from a Linux/Mac machine (and vice versa) is not working.

ulfjack added a commit to ulfjack/bazel that referenced this issue Sep 18, 2020
This helps move Bazel towards being able to perform cross-platform builds
with a remote execution system that's running a different OS. This is in
preparation for updating the rule implementations to use the configuration
setting instead of OS.current() directly.

I'm not sure how this interacts with platforms, but this change seems safe
enough.

Progress on bazelbuild#11748.

Change-Id: I20dff1fb332d4567b621d65e43b05a00905f75b0
@katre
Copy link
Member

katre commented Sep 18, 2020

Sorry, I meant that you can use transitions to build the bundle of libraries for different platforms, if they can all be built on the same platform in individual Bazel invocations. The updates to execution strategy that would be needed for mixed local/remote builds is still in the planning phase.

@cpsauer
Copy link
Contributor

cpsauer commented Sep 22, 2020

Thanks all. Remote builds and tests that trancend platforms... what an awesome goal.

@katre
Copy link
Member

katre commented Dec 11, 2020

Closing this as a dupe of #11432, follow that as the official tracking issue for this effort.

@katre katre closed this as completed Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Configurability Issues for Configurability team type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants