Build failure when building with Bazel on Windows/mingw64
Appears to be the root cause of grpc/grpc#28187
Most protobuf dependent rules work ok on Windows/mingw64. Unfortunately, upb_proto_library and upb_proto_reflection_library are broken somehow.
bazel build --cpu=x64_windows --compiler=mingw-gcc -s --verbose_failures @upb//:descriptor_upb_proto
INFO: Build option --cxxopt has changed, discarding analysis cache. INFO: Analyzed target @upb//:descriptor_upb_proto (0 packages loaded, 1168 targets configured). INFO: Found 1 target... SUBCOMMAND: # @com_google_protobuf//:descriptor_proto [action 'Generating upb protos for :descriptor_proto', configuration: b2b712173e23cb6c867282b6c749b978c36f1df42a5675b02ca89482c8e1a89e, execution platform: @local_config_platform//:host] cd C:/users/oakad/_bazel_oakad/my7jd3mt/execroot/awesome-services bazel-out/host/bin/external/com_google_protobuf/protoc.exe --upb_out=bazel-out/x64_windows-fastbuild/bin/external/com_google_protobuf --plugin=protoc-gen-upb=bazel-out/host/bin/external/upb/upbc/protoc-gen-upb.exe --descriptor_set_in=bazel-out/x64_windows-fastbuild/bin/external/com_google_protobuf/descriptor_proto-descriptor-set.proto.bin google/protobuf/descriptor.proto ERROR: C:/users/oakad/_bazel_oakad/my7jd3mt/external/com_google_protobuf/BUILD:326:15: Generating upb protos for :descriptor_proto failed: (Exit -1073741515): protoc.exe failed: error executing command cd C:/users/oakad/_bazel_oakad/my7jd3mt/execroot/awesome-services bazel-out/host/bin/external/com_google_protobuf/protoc.exe --upb_out=bazel-out/x64_windows-fastbuild/bin/external/com_google_protobuf --plugin=protoc-gen-upb=bazel-out/host/bin/external/upb/upbc/protoc-gen-upb.exe --descriptor_set_in=bazel-out/x64_windows-fastbuild/bin/external/com_google_protobuf/descriptor_proto-descriptor-set.proto.bin google/protobuf/descriptor.proto Execution platform: @local_config_platform//:host Target @upb//:descriptor_upb_proto failed to build INFO: Elapsed time: 1.339s, Critical Path: 0.32s INFO: 2 processes: 2 internal. FAILED: Build did NOT complete successfully
The fix appears to be as easy as inheriting the shell env:
progress_message = "Generating upb protos for :" + ctx.label.name, use_default_shell_env = True,