-
Notifications
You must be signed in to change notification settings - Fork 446
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
fix: Use "exec" for cargo build scripts #3235
fix: Use "exec" for cargo build scripts #3235
Conversation
The nuance between when to use exec vs target is a bit tricky to get right sometimes. You want to use "exec" for executables that are used at build time and "target" for runtime dependencies Since cargo build script are run at build time, they need to be set to exec. This fixes circumstances where a user is using RBE on a platform different than their host machine For example, I found this bug when I enabled my linux based RBE cluster when trying to do a bazel run of a rust binary on my mac. When the build script executed it threw up because the RBE cluster was using the mac version of the script.
f6b8b0b
to
671ec50
Compare
Thanks! Isn't the build script binary already in rules_rust/cargo/private/cargo_build_script.bzl Lines 101 to 106 in d256c7b
And then this rule creates a symlink from that rules_rust/cargo/private/cargo_build_script.bzl Lines 44 to 62 in d256c7b
And returns it as the
This way when rules_rust/cargo/private/cargo_build_script.bzl Lines 624 to 630 in d256c7b
Is there something broken about this interaction? I've also not had much success with cross platform RBE builds (bazelbuild/bazel#19587) but assuming the execution platform is described to be linux, in your case, I would expect all binaries to be built for the right platform. Curious to know how this wouldn't be the case and how to fix it. |
Let me play with this a bit. I have a repo that has RBE so it'll be fast for me to iterate on potential fixes. I'll reply to this when I have more a confirmed fix since this is something that's especially hard to make a test case for with current infrastructure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@UebelAndre IIRC you put a lot of careful thought into the transitions here?
Okay, your analysis was right. I'm going to close this for now and reopen when I've resolved the error. There is still a bug (unless my RBE setup is at fault).
|
The key to what I'm seeing is
The process wrapper is clearly mismatched to the rustc toolchain. Looking into why that is |
Very interesting. I can believe there’s a bug like this somewhere in the process wrapper bootstrapped. Do you know if toolchain resolutions matches what you expect? I’m wondering if there’s a mix up there or something started referring to the |
The nuance between when to use exec vs target
is a bit tricky to get right sometimes. You want
to use "exec" for executables that are used at
build time and "target" for runtime dependencies
Since cargo build script are run at build time,
they need to be set to exec.
This fixes circumstances where a user is using
RBE on a platform different than their host machine
For example, I found this bug when I enabled my
linux based RBE cluster when trying to do a
bazel run of a rust binary on my mac. When the
build script executed it threw up because the RBE
cluster was using the mac version of the script.