Error: ‘InitSCC’ is not a member of ‘google::protobuf::internal’

Failed to build PyTorch from source …

  1. ENV
➜  pytorch git:(master) ✗ git describe --tags
ciflow/libtorch/73011-318-g39605a5632
➜  pytorch git:(master) ✗ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.4 LTS
Release:	20.04
Codename:	focal
➜  pytorch git:(master) ✗ gcc --version
gcc (GCC) 10.3.1 20210627
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

➜  pytorch git:(master) ✗ python --version
Python 3.8.10
  1. ERROR
613 |   inline MapFieldEntry* New() const final {
      |                         ^~~
....../pytorch/build/caffe2/proto/hsm.pb.cc: In member function ‘void caffe2::HierarchyProto::SharedCtor()’:
....../pytorch/build/caffe2/proto/hsm.pb.cc:841:38: error: ‘InitSCC’ is not a member of ‘google::protobuf::internal’
  841 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                      ^~~~~~~
....../pytorch/build/caffe2/proto/hsm.pb.cc:841:47: error: ‘scc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto’ was not declared in this scope; did you mean ‘InitDefaultsscc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto’?
  841 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               InitDefaultsscc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto
....../pytorch/build/caffe2/proto/caffe2.pb.h:3794:26: error: ‘caffe2::BackendOptions* caffe2::BackendOptions::New() const’ marked ‘final’, but is not virtual
 3794 |   inline BackendOptions* New() const final {
      |                          ^~~
....../pytorch/build/caffe2/proto/hsm.pb.cc: In static member function ‘static const caffe2::HierarchyProto& caffe2::HierarchyProto::default_instance()’:
....../pytorch/build/caffe2/proto/hsm.pb.cc:865:38: error: ‘InitSCC’ is not a member of ‘google::protobuf::internal’
  865 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                      ^~~~~~~
....../pytorch/build/caffe2/proto/hsm.pb.cc:865:49: error: ‘::scc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto’ has not been declared; did you mean ‘InitDefaultsscc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto’?
  865 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 InitDefaultsscc_info_HierarchyProto_caffe2_2fproto_2fhsm_2eproto
....../pytorch/build/caffe2/proto/caffe2.pb.h:3970:25: error: ‘caffe2::PartitionInfo* caffe2::PartitionInfo::New() const’ marked ‘final’, but is not virtual
 3970 |   inline PartitionInfo* New() const final {
      |                         ^~~
....../pytorch/build/caffe2/proto/hsm.pb.cc: In member function ‘void caffe2::PathProto::SharedCtor()’:
....../pytorch/build/caffe2/proto/hsm.pb.cc:1083:38: error: ‘InitSCC’ is not a member of ‘google::protobuf::internal’
 1083 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_PathProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                      ^~~~~~~
....../pytorch/build/caffe2/proto/caffe2.pb.h:4192:18: error: ‘caffe2::NetDef* caffe2::NetDef::New() const’ marked ‘final’, but is not virtual
 4192 |   inline NetDef* New() const final {
      |                  ^~~
....../pytorch/build/caffe2/proto/hsm.pb.cc:1083:47: error: ‘scc_info_PathProto_caffe2_2fproto_2fhsm_2eproto’ was not declared in this scope; did you mean ‘InitDefaultsscc_info_PathProto_caffe2_2fproto_2fhsm_2eproto’?
 1083 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&scc_info_PathProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                               InitDefaultsscc_info_PathProto_caffe2_2fproto_2fhsm_2eproto
....../pytorch/build/caffe2/proto/hsm.pb.cc: In static member function ‘static const caffe2::PathProto& caffe2::PathProto::default_instance()’:
....../pytorch/build/caffe2/proto/hsm.pb.cc:1107:38: error: ‘InitSCC’ is not a member of ‘google::protobuf::internal’
 1107 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_PathProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                      ^~~~~~~
Compiling  sendrecv.cu                         > ....../pytorch/build/nccl/obj/collectives/device/sendrecv_prod_i8.o
....../pytorch/build/caffe2/proto/hsm.pb.cc:1107:49: error: ‘::scc_info_PathProto_caffe2_2fproto_2fhsm_2eproto’ has not been declared; did you mean ‘InitDefaultsscc_info_PathProto_caffe2_2fproto_2fhsm_2eproto’?
 1107 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_PathProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 InitDefaultsscc_info_PathProto_caffe2_2fproto_2fhsm_2eproto
....../pytorch/build/caffe2/proto/caffe2.pb.h:4517:25: error: ‘caffe2::ExecutionStep* caffe2::ExecutionStep::New() const’ marked ‘final’, but is not virtual
 4517 |   inline ExecutionStep* New() const final {
      |                         ^~~
....../pytorch/build/caffe2/proto/caffe2.pb.h:4890:19: error: ‘caffe2::PlanDef* caffe2::PlanDef::New() const’ marked ‘final’, but is not virtual
 4890 |   inline PlanDef* New() const final {
      |                   ^~~
cd ....../pytorch/build/sleef/src/libm && ../../bin/mkdisp 4 8 __m256d __m256 __m128i avx fma4 avx2 >> ....../pytorch/build/sleef/src/libm/dispavx.c
....../pytorch/build/caffe2/proto/caffe2.pb.h:5086:21: error: ‘caffe2::BlobProto* caffe2::BlobProto::New() const’ marked ‘final’, but is not virtual
 5086 |   inline BlobProto* New() const final {
      |                     ^~~
....../pytorch/build/caffe2/proto/caffe2.pb.h:5356:25: error: ‘caffe2::DBReaderProto* caffe2::DBReaderProto::New() const’ marked ‘final’, but is not virtual
 5356 |   inline DBReaderProto* New() const final {
      |                         ^~~
....../pytorch/build/caffe2/proto/caffe2.pb.h:5578:36: error: ‘caffe2::BlobSerializationOptions* caffe2::BlobSerializationOptions::New() const’ marked ‘final’, but is not virtual
 5578 |   inline BlobSerializationOptions* New() const final {
      |                                    ^~~
....../pytorch/build/caffe2/proto/caffe2.pb.h:5796:32: error: ‘caffe2::SerializationOptions* caffe2::SerializationOptions::New() const’ marked ‘final’, but is not virtual
 5796 |   inline SerializationOptions* New() const final {
      |                                ^~~
....../pytorch/build/caffe2/proto/hsm.pb.cc: In static member function ‘static const caffe2::PathNodeProto& caffe2::PathNodeProto::default_instance()’:
....../pytorch/build/caffe2/proto/hsm.pb.cc:1356:38: error: ‘InitSCC’ is not a member of ‘google::protobuf::internal’
 1356 |   ::PROTOBUF_NAMESPACE_ID::internal::InitSCC(&::scc_info_PathNodeProto_caffe2_2fproto_2fhsm_2eproto.base);
      |                                      ^~~~~~~
....../pytorch/build/caffe2/proto/caffe2.pb.h: In member function ‘void caffe2::TensorProto_Segment::clear_begin()’:
....../pytorch/build/caffe2/proto/caffe2.pb.h:5897:12: error: ‘PROTOBUF_LONGLONG’ was not declared in this scope

Can anybody give me a hand please?

Cheers
Pei