Skip to content
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

The repository '@com_google_protobuf' could not be resolved #1657

Closed
tinkerbeast opened this issue Nov 4, 2023 · 1 comment
Closed

The repository '@com_google_protobuf' could not be resolved #1657

tinkerbeast opened this issue Nov 4, 2023 · 1 comment

Comments

@tinkerbeast
Copy link

tinkerbeast commented Nov 4, 2023

What version of gazelle are you using?

Not using gazelle.

What version of rules_go are you using?

Not using rules_go.

What version of Bazel are you using?

bazel 3.5.1- (@non-git)

Does this issue reproduce with the latest releases of all the above?

Did not check this since these are the latest available version on Ubuntu 22.04 and I am stuck with the OS.

What operating system and processor architecture are you using?

Linux 6.2.0-36-generic 22.04.1-Ubuntu x86_64

What did you do?

Directory structure as follows:

├── proto
│   ├── BUILD
│   └── hello.proto
└── WORKSPACE

Empty WORKSPACE file.

The BUILD file is as follows:

package(default_visibility = ["//visibility:public"])

load("@rules_proto//proto:defs.bzl", "proto_library")

proto_library(
    name = "hello_proto",
    srcs = ["hello.proto"],
)

My protoc version is libprotoc 3.12.4.

The build command was bazel build proto:hello_proto.

What did you expect to see?

Build go through.

What did you see instead?

ERROR: /home/rishin/workspace/grpc_blaze/proto/BUILD:5:14: every rule of type proto_library implicitly depends upon the target '@com_google_protobuf//:protoc', but this target could not be found because of: no such package '@com_google_protobuf//': The repository '@com_google_protobuf' could not be resolved
ERROR: Analysis of target '//proto:hello_proto' failed; build aborted: Analysis failed

@tinkerbeast
Copy link
Author

Fixed after I added protoc dependency as http archive -

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "com_google_protobuf",
    sha256 = "540200ef1bb101cf3f86f257f7947035313e4e485eea1f7eed9bc99dd0e2cb68",
    strip_prefix = "protobuf-3.25.0",
    # latest, as of 2023-11-02
    urls = [
        "https://github.com/protocolbuffers/protobuf/archive/v3.25.0.tar.gz",
    ],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant