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
cmd/go: race detector and cgo builds needs to diagnose lack of C compiler more gracefully #44271
Comments
The simplest reproducer I can think of:
This message is what I see on Linux; apparently, the StackOverflow's user saw something different due to a different OS. The root problem is that C compiler is missing and we print a cryptic (?) message on this. We probably want to check C compiler presence beforehand and print something more understandable. @ianlancetaylor what do you think? -- is current behavior acceptable or is it better to fix it? Yours, |
I think we should fix this if possible. Thanks. |
Got it. Let me take a stab on this. @ianlancetaylor could you, please, assign this one on me? |
I'm pretty sure the user was on a Mac, where there's at least three failure modes:
|
Presence of Xcode (on "Catalina", aka macOS 10.15):
The real clang is not small:
The Xcode licensing failure is I think a little bit more self-explanatory when it fails, but not something I'd call new-user-friendly. The "Installing MacPorts" web page provides typical guidance, beginning at "Please note". |
Change https://golang.org/cl/301249 mentions this issue: |
@dr2chase These references to XCode behavior are definitely useful -- thanks! However, I don't think it makes sense to replicate it verbatim, let alone handle situations like no Xcode, no command-line tools, etc separately. Remember that go supports a variety of operating systems and toolchain environments. |
@ianlancetaylor I cooked up a patch; please kindly take a look: https://go-review.googlesource.com/c/go/+/301249 There is no unit test, but I don't see how one can be added for the code like this -- unless we want to call the entire "main" function as a unit test. |
NB this is forwarded from a Stack Overflow question.
A new user had this experience:
I can't reproduce this without trashing my Xcode install which I'd rather not, but it is almost certainly the case that said/sad user lacks a C compiler, and building with the race detector requires a C compiler. If we could detect this situation and give a more helpful error message, that would probably improve the on-ramp experience.
The text was updated successfully, but these errors were encountered: