-
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
[BUG] tools in genrule can not be built with alternative toolchain / platform #12942
Comments
Hi Jan, Can you trace out some pseudo-code of what you're expecting? I can't tell from the report if you expect the alternative toolchain to build the target in Can you also clarify which language's toolchain you mean? |
Hi Greg, I am talking about the c++ cc_toolchain.
the build rule of the tool looks like this:
as you can see the tool_to_build is not expected to be compatible with the bazel default toolchain, only with the "fancy_custom_toolchain" but as per documentation bazel always uses the default toolchain to build tools and we have not found any means to even redirect the default toolchain to our fancy_custom_toolchain. Thanks for your help! |
I see. What about some combination of using "target" is the machine the binary you're building will run on. "host" and "exec" are similar concepts that are the machine that actually runs the compilers and linkers. Targets in |
Thanks Greg, that could be a feasible solution for us! |
Can you share a simple repro of that error? |
Interesting, I cannot repro it in a minimal example, looks like one of our dependencies is pulling in the java dependency.
Thanks a lot for your help! |
Update, using
do you have an idea how I can find out who could be pulling in the java dependencies? |
Okay, I found the issue:
|
Hi Greg, |
Apologies that I slipped on this for a while. I tried your repro and see the same behavior. Can you show a similar repro that doesn't have the JDK problem (i.e. the original issue you filed, which still had an error, but not that error). Maybe starting from there would make it easier to resolve, especially with a clear repro we can all experimentally adjust. |
The JDK problem appears as soon as we register a custom c++ toolchain. The only way to get rid of it is to use the standard c++ toolchain. In the meantime we found a workaround by manually specifying host_javabase in bazelrc: |
Some more context:
That first dep on
I have no idea why a custom toolchain would trigger that while the default wouldn't. I'll see if I can CC someone familiar with the coverage logic - they'd probably be able to gauge it best. Aside from that, with the |
@coeuvre - do you have any insights about the above comment? How |
I am not familiar with this part so it could be wrong but it seems that the custom toolchain is using default value of |
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team ( |
Description of the problem / feature request:
In our repository we are maintaining our own toolchain using the platform concept.
However there is no way for us to force a tool specified inside a genrule to be built with our own toolchain, neither to overwrite the default toolchain bazel uses.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
What operating system are you running Bazel on?
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
Kernel: 5.8.0-40-generic
What's the output of
bazel info release
?release 4.0.0
Have you found anything relevant by searching the web?
Bazel specifies this behavior as expected:
https://docs.bazel.build/versions/master/be/general.html
However if the default host toolchain is not suitable for compiling the tool there is no way for us to force the usage of an alternative toolchain.
The text was updated successfully, but these errors were encountered: