Fix exec transition handling in cc tool_map for multiplatform builds#548
Fix exec transition handling in cc tool_map for multiplatform builds#548dzbarsky wants to merge 1 commit into
Conversation
|
@armandomontanez @pzembrod A full fix for the toolchain resolution behavior would require moving the |
|
I'm on board. For now, I'm going to manually import this change and patch in a docs update that reflects the behavioral change. This was the near-term direction we decided on for #299, and as @fmeum has mentioned now that most of the rules_cc implementation has been moved into this repo, we can pursue the better solution of doing an exec transition from the top. We talked about potentially doing this quite a while back, but I'd like to double check with @pzembrod to make sure we have a green light to pursue that right now. |
|
I'd prefer we do the real fix Fabian mentions instead of trying to land this first. I think if we land this as-is it will break using 'select' on the platform. This stuff is pretty subtle and we should be careful and do a holistic fix IMO |
5a34f39 to
86451a0
Compare
|
OK I updated the PR to keep the |
armandomontanez
left a comment
There was a problem hiding this comment.
Thanks, will merge after I get a 2nd approval internally.
These extra exec transitions are harmful because they allow Bazel to select a different exec platform than the one the toolchain is being used on. This means when host != exec (say Windows host, Linux remote), the wrong compiler can be picked and the build fails.
Without this patch, users who want to support multiplatform builds need to hack it by forcing the tools to transition to the correct exec platform, since the toolchain "forgets". See example workaround being reverted and CI works when patch is applied
While I was here I cleaned up the example a bit to be more like the canonical usage of
cc_tool.