bazel grpc 集成失败,并显示“:错误:‘PROTOBUF_NAMESPACE_OPEN’未命名类型”

问题描述 投票:0回答:1

我正在按照此处列出的简单步骤将 gRPC (v1.64.1) 合并到 Linux 上的 bazel (v7.1.0) 工作区中。我使用 Linux docker 容器 (ubuntu:focal) 作为构建环境。我的 workspace 文件遵循广告中的步骤,并且我已将 helloworld 应用程序移植到我的存储库中(我称之为 greeter)。

当我构建问候语(helloworld)时,我收到以下错误:

$ bazel build //utils/greeter:greeter_client
INFO: Analyzed target //utils/greeter:greeter_client (2 packages loaded, 135 targets configured).
. . .
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from bazel-out/aarch64-opt-exec-ST-13d3ddad9198/bin/external/com_google_protobuf/src/google/protobuf/util/_virtual_includes/time_util/google/protobuf/util/time_util.h:30,
                 from external/com_google_protobuf/src/google/protobuf/util/time_util.cc:8:
bazel-out/aarch64-opt-exec-ST-13d3ddad9198/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/duration_proto/google/protobuf/duration.pb.h:36:1: error: 'PROTOBUF_NAMESPACE_OPEN' does not name a type
   36 | PROTOBUF_NAMESPACE_OPEN
      | ^~~~~~~~~~~~~~~~~~~~~~~
bazel-out/aarch64-opt-exec-ST-13d3ddad9198/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/duration_proto/google/protobuf/duration.pb.h:40:1: error: 'PROTOBUF_NAMESPACE_CLOSE' does not name a type
   40 | PROTOBUF_NAMESPACE_CLOSE
      | ^~~~~~~~~~~~~~~~~~~~~~~~

<s n i p>

external/com_google_protobuf/src/google/protobuf/util/time_util.cc:117:13: warning: 'std::string google::protobuf::util::{anonymous}::FormatTime(int64_t, int32_t)' defined but not used [-Wunused-function]
  117 | std::string FormatTime(int64_t seconds, int32_t nanos) {
      |             ^~~~~~~~~~
Target //utils/greeter:greeter_client failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 7.331s, Critical Path: 5.17s
INFO: 14 processes: 11 internal, 3 linux-sandbox.
ERROR: Build did NOT complete successfully

gRPC(v1.64.1)似乎依赖于 protobuf(v26.1),它试图构建但没有成功。我不确定这是否是构建环境问题。 docker 容器提供了一个可能缺乏某些依赖项的受限环境。我怀疑构建环境中是否存在任何可能与 protobuf 构建冲突的东西。有什么想法吗?

protocol-buffers grpc bazel
1个回答
0
投票

这方面有进展吗?我也有同样的问题。

 ----> gRPC_VERSION=1.64.0
 ----> protobuf_VERSION=26.1.0
© www.soinside.com 2019 - 2024. All rights reserved.