-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Improve error message for unresolved toolchains #15135
Conversation
cc'ing @gregestren because we've interacted before on platforms stuff, and @lberki and @ahumesky since they were active on that other issue. |
You're very welcome. Thank you. Thanks also for the crosslink. Haven't delved too deep into implementing toolchains yet--just the basics of selecting and using. LMK if you think these will collide somehow. -Chris |
This all looks good to me, and I think your reasons are sound. I definitely support more generically actionable messaging (beyond just C++). I really don't know if the old link is still meaningfully relevant. Given no clear argument that it is, I'm happy to exclude it by default. The only nitty thing I wonder about is I think of CC @katre just FYI. |
Thanks, @gregestren! Really appreciate your thoughtfulness and your getting back to me. Sounds like we're well aligned on shipping this. Awesome. On the link: Happy to add if you'd like. But I do earnestly think that users will be ready for All that said, I'll of course happily defer to you if you still think we should add the link! In that case, what about appending an additional line something like: "If platforms or toolchains are a new concept to you, we'd encourage reading https://bazel.build/concepts/platforms-intro." ? |
I imagine (hope) that over time it's more likely that novice users will use platform-enabled builds, even if they don't realize it (i.e. just by using a rule set the implicitly use toolchains). I think a concise link would be helpful. Although it could be in |
@@ -436,7 +436,7 @@ use_toolchain( | |||
EOF | |||
|
|||
bazel build "//${pkg}/demo:use" &> $TEST_log && fail "Build failure expected" | |||
expect_log "While resolving toolchains for target //${pkg}/demo:use: No matching toolchains found for types //${pkg}/toolchain:test_toolchain. To debug, rerun with --toolchain_resolution_debug='//${pkg}/toolchain:test_toolchain'" | |||
expect_log "While resolving toolchains for target //${pkg}/demo:use: No matching toolchains found for types //${pkg}/toolchain:test_toolchain.\nTo debug, rerun with --toolchain_resolution_debug='//${pkg}/toolchain:test_toolchain\nIf platforms or toolchains are a new concept to you, we'd encourage reading https://bazel.build/concepts/platforms-intro.'" |
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.
expect_log does regex matching, so you really only need the "To debug" part, not the tailing bit.
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.
Ah, cool. Thanks, John. Will slim down to just the "To debug" part, per your suggestion.
[I see the grep-based implementation now, which I think precludes having newlines in the pattern--and while I'd aimed for completeness before, I suppose that one line does fully test the mismatch. Sorry also that you saw the test failures--figured I'd just quickly run the change by CI and then tap back today after it finished.]
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.
Err, actually, if we're just looking to check that there's a mismatch error with the right toolchain type, probably I should change the expect_log to just be the first error line. Same spirit, but more directly checking the error. Hopefully that's okay.
Add link to general platforms docs in response to feedback
Great! New commit up and green, hopefully responding well to your good feedback. @gregestren, sounds like you'd still like that link: It's in--with a minor wording improvement from what I'd put up before. |
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.
LGTM, let's see if Greg has anything left to say.
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.
LGTM. Thanks, Chris.
Strange: on merge I'm getting CI failures like https://storage.googleapis.com/bazel-untrusted-buildkite-artifacts/c0202940-cb70-42de-816e-a9b3fa85cf83/src%5Ctest%5Cjava%5Ccom%5Cgoogle%5Cdevtools%5Cbuild%5Clib%5Cskyframe%5CSkyframeTests%5Cshard_15_of_20%5Ctest_attempts%5Cattempt_1.log. which correlates to bazel/src/test/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunctionTest.java Line 192 in e6fbe5b
Why didn't the PR checks catch this? |
Was the PR not merged to head?
…On Thu, May 5, 2022, 5:08 PM Greg ***@***.***> wrote:
Strange: on merge I'm getting CI failures like
https://storage.googleapis.com/bazel-untrusted-buildkite-artifacts/c0202940-cb70-42de-816e-a9b3fa85cf83/src%5Ctest%5Cjava%5Ccom%5Cgoogle%5Cdevtools%5Cbuild%5Clib%5Cskyframe%5CSkyframeTests%5Cshard_15_of_20%5Ctest_attempts%5Cattempt_1.log
.
which correlates to
https://github.com/bazelbuild/bazel/blob/e6fbe5b6cbc33375731bf0d6315fb31264211a80/src/test/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunctionTest.java#L192
.
Why didn't the PR checks catch this?
—
Reply to this email directly, view it on GitHub
<#15135 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACPW75FGXCPNPBMC2TOTMTVIQ2ERANCNFSM5R46SNGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@gregestren, looks like it's a new test @katre added several days ago, so it wasn't on the feature branch corresponding to this PR. |
How about if I merge in master and fix? |
Great. Done. Tests rerunning! |
And we're green! Good to merge? |
Trying again. Thanks, Chris. |
@bazel-io flag |
@bazel-io fork 5.2.0 |
Closes #15135. PiperOrigin-RevId: 447028054 Co-authored-by: Christopher Peterson Sauer <christophersauer@pacbell.net>
Hi wonderful Bazel folks,
I happened to look back at #10134 (comment), and #10134 more generally, and noticed that people had been reacting, requesting a change I'd floated, so I PR'd it. In brief, this PR proposes a fix that aims to resolve the issues that lead to user frustration there.
Please do read that issue for context before reviewing, but first, briefly some context around it:
Background: It's common to need to debug toolchain matching problems when getting set up with Bazel platforms.
Problem: The current error message doesn't point users to Bazel's (great!) debugging mechanism (
--toolchain_resolution_debug
). Instead the error links people to what's more likely to be a red herring (that issue, #10134), leading to lots of user frustration there. The original message seems like it was probably the right one back when flipping the flag seemed imminent, but the general consensus now seems to be that the link wasn't helpful and should be removed. Besides some flaming, a bunch of people had 👍🏻'd or ❤️'d the--toolchain_resolution_debug
debugging actions I'd posted to indicate that they wanted it added to the error message. (Those reacts are what I'd happened to see when someone posted on the issue, sending a notification.)Solution: So this PR changes the error message to (1) add actionable advice to use the debugging flag and (2) remove the link to the issue. [Minor: It also makes capitalization and punctuation consistent between the error cases.]
I'd love your thoughtful consideration and review!
Thanks, wonderful Bazel folks, for all you do!
Cheers,
Chris
(ex-Googler)
P.S. If you'd rather leave the link to #10134 in the error message--and just add the actionable debugging suggestion, we could totally do that, too. I agonized a bit over whether to remove the link, before deciding to because (1) it seemed pretty unlikely that someone would flip the flag given its status, (2) people had explicitly suggested it be removed and (3) there's the opportunity to add instructions if and when the flag is picked back up. All that said, if you'd like to add the messaging back in, we could totally just append it to the error message! (I've checked the "allow edits by maintainers" box, too, so you can just do so and merge!) Might make sense to wordsmith a little at the same time, to reduce confusion? And also, if we re-add it, should the condition be instead whether the cpp toolchain type is anywhere in the list?