-
-
Notifications
You must be signed in to change notification settings - Fork 667
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
rules_go does not respect CC #1320
Comments
Thanks for reporting. I don't know if it's possible to resolve this with the old Are you able to build cc @ianthehat Is this something that would require a custom CROSSTOOL? |
Some more details: Seeing this when updating from From one of the failing tests: In different test:
Different output due to different C++ compiler used. |
Running this fixed the build, so it's really just an issue of plumbing through the C compiler:
|
Ok, I've done some research into this, and I think I have a better understanding of what's happening. Bazel will configure a C / C++ toolchain using something that's nominally a C compiler (like The name of the C compiler is exposed to Skylark rules (i.e., rules_go). We get this from From the error message you posted earlier, I think this is the problem:
That looks like a custom value coming from your environment. I think if you pass in |
Yup, that seems to be the issue. I was kinda surprised that Bazel doesn't let you differentiate between C++/C compiler (like cmake et al) does, but I guess this is okay. Turns out the specific project I was running into uses a custom cc toolchain that looks for g++ instead of gcc for the cpp fragment. Gonna close this out because I don't think this is a rules_go issue Thanks a lot for providing the additional context, sorry about the noise. |
Compiling the standard library requires both a C and a C++ compiler. Normally this is fine, as rules_go grabs the compilers from the path (I think? or well known location?), but if you try to override the compilers with
CXX
andCC
rules_go will use the location specified byCXX
for both the C and C++ compiler, resulting in this:That is: it's trying to compile C code with a C++ compiler, which forbids this kind of implicit casting.
The offending code in rules_go is here:
https://github.com/bazelbuild/rules_go/blob/cdaa8e35cf53ba539ebe5bf6a4a407f91a284594/go/tools/builders/env.go#L98-L104
It's reading the
cc
value from the C++ fragment in Bazel which respectsCXX
. Since it sets the same value for bothCC
andCXX
here, it's not possible to override a specific C compiler (not even a C++ one unless it can also be used as a C compiler).I realize this might be due to a lack of a specific C toolchain in bazel, but I figured I should file the issue regardless.
The text was updated successfully, but these errors were encountered: