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
Pass use_default_shell_env = True for protoc #8984
Conversation
If protoc is compiled with MinGW it will depend on libstdc++-6.dll which is found in C:\msys64\mingw64\bin and can only be found by inheriting PATH from the environment.
|
There are 2 failures in the "Linux artifacts" CI. I understand the first one is a flake but the second one?
|
@sanjaypujare I'll see if I can reproduce it locally. |
Thanks. Most probably the failure is not related to your change. Also looking at https://groups.google.com/g/bazel-discuss/c/7B0FaU5Pkmo/m/6uvsIs2oAQAJ which says "Why do you need PATH inside the action? If you intend to use a tool in the action, the tool should be an input of the action, otherwise Bazel doesn't know about the dependency and cannot guarantee build correctness." Based on this is there an alternative fix for what you want to achieve? |
In general yes but Bazel's default system toolchains are not fully hermetic. The system compiler, headers and runtime libraries exist outside of Bazel's build graph. As expected this sometimes requires clearing Bazel's cache when those things change. Setting up a hermetic toolchain is an effort that Bazel users are in general not required to pursue. For MSVC the dynamically linked |
CC @ejona86 - whether to accept this change to support MinGW. |
The test failures are unrelated. This change could only impact the Bazel CI. Hmm... I don't see good docs surrounding this. It isn't clear what the environment is when use_default_shell_env=False nor when it is appropriate to use use_default_shell_env=True. And with bazelbuild/bazel#5980, it makes me uncomfortable and seems like "this is not normal." This seems like a very basic issue. If Bazel has to have this to execute binaries it builds, it seems that should be documented somewhere and would impact a lot (including I do see proto_library swapped to Although, this actually exposes that it seems the proto_common stuff is far enough along now that we don't have to execute protoc ourselves and we can tie into the common infra. I hadn't realized that the proto swap to bzl had finally happened, although it did happen pretty recently and hasn't been released yet. That deserves playing around with the rule some more later. |
It is a basic issue. I would expect a simple Someone more familiar with Bazel's C++ toolchains might be able to suggest a solution at the toolchain level, such as copying |
May be open an issue in https://github.com/bazelbuild/rules_cc to follow up on this? |
(I wasn't sure it would get any visibility on rules_cc as it looks a bit dormant) |
Tests failed again: github/grpc-java/api/build/test-results/test/TEST-io.grpc.CallOptionsTest I'll try this one more time. |
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
Apparently, rules_go doesn't actually use proto_common stuff (i.e., create_proto_compile_action). I guess the test just used proto_common indirectly through proto_library and the test failed. But the rules themselves would have been unimpacted. FWIW, rules_go manages Windows a bit differently, and I'm not convinced it is better: |
If protoc is compiled with MinGW it will depend on libstdc++-6.dll which is found in C:\msys64\mingw64\bin and can only be found by inheriting PATH from the environment.
If protoc is compiled with MinGW it will depend on libstdc++-6.dll which is found in C:\msys64\mingw64\bin and can only be found by inheriting PATH from the environment.
Fixes #8983