Skip to content

[bazel] Got "missing strict dependencies" when use protoc-gen-grpc-gateway as bazel-gazelle grpc compiler #1941

Closed
@asv

Description

🐛 Bug Report

I want to use protoc-gen-grpc-gateway as grpc_compiler to generate code in my bazel project.
For this Im specify protoc-gen-grpc-gateway as compiler for my grpc protos.

# gazelle:go_grpc_compilers @com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway                                                                            
gazelle(                                                                                                                                                                                       
    name = "gazelle",                                                                                                                                                                          
)

When I try to generate the code using bazel build //proto/..., I get the following error:

$ bazelisk build  //proto/...
INFO: Analyzed 3 targets (1 packages loaded, 3 targets configured).
INFO: Found 3 targets...
ERROR: /home/asmirnov/.cache/bazel/_bazel_asmirnov/e3c23bb5a397a370f5928992b61209fd/external/com_github_grpc_ecosystem_grpc_gateway_v2/protoc-gen-openapiv2/options/BUILD.bazel:15:11: GoCompilePkg external/com_github_grpc_ecosystem_grpc_gateway_v2/protoc-gen-openapiv2/options/go_default_library.a failed (Exit 1): builder failed: error executing command bazel-out/host/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src ... (remaining 47 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox builder failed: error executing command bazel-out/host/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux_amd64 -src ... (remaining 47 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
compilepkg: missing strict dependencies:
        /home/asmirnov/.cache/bazel/_bazel_asmirnov/e3c23bb5a397a370f5928992b61209fd/sandbox/linux-sandbox/657/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_github_grpc_ecosystem_grpc_gateway_v2/protoc-gen-openapiv2/options/options_go_proto_/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/annotations.pb.go: import of "google.golang.org/protobuf/types/descriptorpb"
        /home/asmirnov/.cache/bazel/_bazel_asmirnov/e3c23bb5a397a370f5928992b61209fd/sandbox/linux-sandbox/657/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/com_github_grpc_ecosystem_grpc_gateway_v2/protoc-gen-openapiv2/options/options_go_proto_/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.pb.go: import of "google.golang.org/protobuf/types/known/structpb"
No dependencies were provided.
Check that imports in Go sources match importpath attributes in deps.
INFO: Elapsed time: 7.732s, Critical Path: 2.91s
INFO: 22 processes: 6 internal, 16 linux-sandbox.
FAILED: Build did NOT complete successfully

reprorep: https://github.com/asv/grpc_gw_bazel_bug

To Reproduce

  1. git clone https://github.com/asv/grpc_gw_bazel_bug
  2. cd grpc_gw_bazel_bug
  3. bazel build //proto/...

Expected behavior

bazel build completed successful.

Actual Behavior

bazel build failed with error "missing strict dependencies".

Your Environment

$ uname -ra
Linux asmirnov 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ bazelisk version
Bazelisk version: v1.4.0
Build label: 3.7.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Oct 20 13:29:16 2020 (1603200556)
Build timestamp: 1603200556
Build timestamp as int: 160320055

protobuf 3.14
rules_go 0.25.1
bazel-gazelle 0.22.3

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions