我需要什么 Bazel 咒语来包含 gRPC 反射头文件?
What Bazel incantation do I need to include gRPC reflection header file?
当我尝试编译使用 gRPC 反射的 bazel 项目时,出现以下错误。
fatal error: external/com_github_grpc_grpc/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h: No such file or directory
在我的 WORKSPACE 中,我有以下绑定:
def _com_github_grpc_grpc():
external_http_archive("com_github_grpc_grpc")
external_http_archive("build_bazel_rules_apple")
# Rebind some stuff to match what the gRPC Bazel is expecting.
native.bind(
name = "protobuf_headers",
actual = "@com_google_protobuf//:protobuf_headers",
)
native.bind(
name = "libssl",
actual = "//external:ssl",
)
native.bind(
name = "cares",
actual = "//external:ares",
)
native.bind(
name = "grpc",
actual = "@com_github_grpc_grpc//:grpc++",
)
在我的 BUILD 文件中,我有以下 deps
:
deps = [
"//external:protobuf_headers",
"//external:grpc",
],
我需要什么额外的咒语才能包含在问题的顶部?
在深入研究问题后,我发现我需要以下 WORKSPACE
workspace(name = "xxx")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_github_grpc_grpc",
strip_prefix = "grpc-master",
urls = ["https://github.com/grpc/grpc/archive/master.tar.gz"],
)
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
grpc_extra_deps()
和以下构建:
cc_binary(
name = "ReflectionPlay",
copts = ["-std=c++17"],
srcs = ["reflection_play.cc"],
deps = [
"@com_github_grpc_grpc//:grpc++",
"@com_github_grpc_grpc//:grpc++_reflection",
"@com_github_grpc_grpc//:grpcpp_admin",
],
)
当我尝试编译使用 gRPC 反射的 bazel 项目时,出现以下错误。
fatal error: external/com_github_grpc_grpc/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h: No such file or directory
在我的 WORKSPACE 中,我有以下绑定:
def _com_github_grpc_grpc():
external_http_archive("com_github_grpc_grpc")
external_http_archive("build_bazel_rules_apple")
# Rebind some stuff to match what the gRPC Bazel is expecting.
native.bind(
name = "protobuf_headers",
actual = "@com_google_protobuf//:protobuf_headers",
)
native.bind(
name = "libssl",
actual = "//external:ssl",
)
native.bind(
name = "cares",
actual = "//external:ares",
)
native.bind(
name = "grpc",
actual = "@com_github_grpc_grpc//:grpc++",
)
在我的 BUILD 文件中,我有以下 deps
:
deps = [
"//external:protobuf_headers",
"//external:grpc",
],
我需要什么额外的咒语才能包含在问题的顶部?
在深入研究问题后,我发现我需要以下 WORKSPACE
workspace(name = "xxx")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_github_grpc_grpc",
strip_prefix = "grpc-master",
urls = ["https://github.com/grpc/grpc/archive/master.tar.gz"],
)
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
grpc_deps()
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
grpc_extra_deps()
和以下构建:
cc_binary(
name = "ReflectionPlay",
copts = ["-std=c++17"],
srcs = ["reflection_play.cc"],
deps = [
"@com_github_grpc_grpc//:grpc++",
"@com_github_grpc_grpc//:grpc++_reflection",
"@com_github_grpc_grpc//:grpcpp_admin",
],
)