envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
25.07k stars 4.82k forks source link

Build results in Protobuf errors #37266

Open Jenkins-J opened 1 day ago

Jenkins-J commented 1 day ago

Title: Building envoy results in protobuf compile errors

Description: When attempting to build envoy, the build fails with the below errors related to protobuf. bazel build --subcommands --cpu=ppc --sandbox_debug --action_env=CC=clang-14 --action_env=CXX=clang++-14 --linkopt=-fuse-ld=lld-14 --verbose_failures --define=boringssl=fips //source/exe:envoy-static

In file included from external/com_google_protobuf/src/google/protobuf/util/field_mask_util.cc:8:
In file included from bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/util/_virtual_includes/field_mask_util/google/protobuf/util/field_mask_util.
h:17:
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:166:3: e
rror: unknown type name 'PROTOBUF_ATTRIBUTE_REINITIALIZES'
  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
  ^
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:173:29:
error: only virtual member functions can be marked 'final'
  int GetCachedSize() const final { return _impl_._cached_size_.Get(); }
                            ^~~~~~
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:178:38:
error: only virtual member functions can be marked 'final'
  void SetCachedSize(int size) const final;
                                     ^~~~~
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:92:9: 
error: use of undeclared identifier 'GetOwningArena'
    if (GetOwningArena() == from.GetOwningArena()
        ^
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:92:34: 
error: no member named 'GetOwningArena' in 'google::protobuf::FieldMask'
    if (GetOwningArena() == from.GetOwningArena()
                            ~~~~ ^
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:139:9: 
error: use of undeclared identifier 'GetOwningArena'
    if (GetOwningArena() == other->GetOwningArena()) {
        ^
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:139:36: 
error: no member named 'GetOwningArena' in 'google::protobuf::FieldMask'
    if (GetOwningArena() == other->GetOwningArena()) {
                            ~~~~~  ^
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:148:17: 
error: use of undeclared identifier 'GetOwningArena'
    ABSL_DCHECK(GetOwningArena() == other->GetOwningArena());
                ^
bazel-out/ppc-opt-exec-ST-d57f47055a04/bin/external/com_google_protobuf/src/google/protobuf/_virtual_includes/field_mask_proto/google/protobuf/field_mask.pb.h:148:44: 
error: no member named 'GetOwningArena' in 'google::protobuf::FieldMask'
    ABSL_DCHECK(GetOwningArena() == other->GetOwningArena());
                                    ~~~~~  ^

All of the errors appear to be in a file (field_mask.pb.h) that is generated by the protobuf build process:

// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/protobuf/field_mask.proto

Using bazel query, I've found the dependency path to the failing protobuf target:

//source/exe:envoy-static
//source/exe:envoy_main_entry_lib
//source/server:options_lib
@envoy_api//envoy/admin/v3:pkg_cc_proto
@com_google_protobuf//:protobuf
@com_google_protobuf//src/google/protobuf:protobuf_layering_check_legacy
@com_google_protobuf//src/google/protobuf/util:field_mask_util

Envoy version (from VERSION.txt): 1.32.0-dev

Any information would be helpful. Thank you

soulxu commented 13 hours ago

cc @phlax