protocolbuffers / protobuf

Protocol Buffers - Google's data interchange format
http://protobuf.dev
Other
65.64k stars 15.49k forks source link

[Build] gRPC fails to build with Bazel using the HEAD version of protobuf #17687

Closed veblush closed 1 month ago

veblush commented 3 months ago

gRPC Continuous Build began to fail since Jul 18. I suspect that https://github.com/protocolbuffers/protobuf/commit/3ff2cf05f341a2ebe9e4e79e59717f85cfd5d601 is the root cause based on the error message.

What version of protobuf and what language are you using?

https://github.com/protocolbuffers/protobuf/commit/3ff2cf05f341a2ebe9e4e79e59717f85cfd5d601 C++

What operating system (Linux, Windows, ...) and version?

Linux

What runtime / compiler are you using (e.g., python version or gcc version)

Bazel 7.2

What did you do?

Build gRPC with the HEAD version of protobuf using Bazel 7.2

What did you expect to see

Build Success

What did you see instead?

Build Failure with this message

ERROR: /home/kbuilder/.cache/bazel/_bazel_kbuilder/038ec57916474bbdcc3968aecb5703c2/external/com_google_protobuf/src/google/protobuf/BUILD.bazel:101:14: in proto_library rule @@com_google_protobuf//src/google/protobuf:timestamp_proto: 
Traceback (most recent call last):
    File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/038ec57916474bbdcc3968aecb5703c2/external/com_google_protobuf/bazel/private/proto_library_rule.bzl", line 67, column 39, in _proto_library_impl
        import_prefix = _get_import_prefix(ctx)
    File "/home/kbuilder/.cache/bazel/_bazel_kbuilder/038ec57916474bbdcc3968aecb5703c2/external/com_google_protobuf/bazel/private/proto_library_rule.bzl", line 39, column 17, in _get_import_prefix
        if not paths.is_normalized(import_prefix):
Error: 'struct' value has no field or method 'is_normalized'
Available attributes: basename, dirname, is_absolute, join, normalize, relativize, replace_extension, split_extension
ERROR: /home/kbuilder/.cache/bazel/_bazel_kbuilder/038ec57916474bbdcc3968aecb5703c2/external/com_google_protobuf/src/google/protobuf/BUILD.bazel:101:14: Analysis of target '@@com_google_protobuf//src/google/protobuf:timestamp_proto' failed

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

Anything else we should know about your project / environment

You can see this log

veblush commented 3 months ago

@comius and @zhangskz PTAL.

zhangskz commented 3 months ago

Looks like is_normalized used by this change was added to bazel skylib in 1.7.0, and this was bumped for protobuf in protobuf_deps.bzl to 1.7.0 accordingly.

Looks like grpc's bazel skylib version in grpc_deps.bzl is still on 1.0.3 which is applied first and thus used instead. This probably needs to get upgraded to 1.7.0.

veblush commented 2 months ago

Thanks, I'll let you know whether upgrading skylib could solve this.