LilyWangLL opened a new issue #1676:
URL: https://github.com/apache/incubator-brpc/issues/1676


   **Describe the bug (描述bug)**
   Hello, I'm a member of Microsoft VCPKG. When I upgrade `protobuf` to 3.19.3, 
`brpc` build failed with the following error:
   ```
   
/mnt/vcpkg-ci/buildtrees/brpc/src/a1b8d7f990-fb64781158.clean/src/brpc/nshead_service.h:66:19:
 error: cannot declare field ‘brpc::NsheadClosure::_request’ to be of abstract 
type ‘brpc::NsheadMessage’
      66 |     NsheadMessage _request;
         |                   ^~~~~~~~
   In file included from 
/mnt/vcpkg-ci/buildtrees/brpc/src/a1b8d7f990-fb64781158.clean/src/brpc/nshead_service.h:23,
                    from 
/mnt/vcpkg-ci/buildtrees/brpc/src/a1b8d7f990-fb64781158.clean/src/brpc/builtin/connections_service.cpp:28:
   
/mnt/vcpkg-ci/buildtrees/brpc/src/a1b8d7f990-fb64781158.clean/src/brpc/nshead_message.h:30:7:
 note:   because the following virtual functions are pure within 
‘brpc::NsheadMessage’:
      30 | class NsheadMessage : public ::google::protobuf::Message {
         |       ^~~~~~~~~~~~~
   In file included from 
/mnt/vcpkg-ci/buildtrees/brpc/x64-linux-dbg/brpc/options.pb.h:30,
                    from 
/mnt/vcpkg-ci/buildtrees/brpc/src/a1b8d7f990-fb64781158.clean/src/brpc/controller.h:31,
                    from 
/mnt/vcpkg-ci/buildtrees/brpc/src/a1b8d7f990-fb64781158.clean/src/brpc/builtin/connections_service.cpp:24:
   /mnt/vcpkg-ci/installed/x64-linux/include/google/protobuf/message.h:251:12: 
note:    ‘virtual google::protobuf::Message* 
google::protobuf::Message::New(google::protobuf::Arena*) const’
     251 |   Message* New(Arena* arena) const override = 0;
         |            ^~~
   In file included from 
/mnt/vcpkg-ci/buildtrees/brpc/src/a1b8d7f990-fb64781158.clean/src/brpc/builtin/connections_service.cpp:28:
   
/mnt/vcpkg-ci/buildtrees/brpc/src/a1b8d7f990-fb64781158.clean/src/brpc/nshead_service.h:67:19:
 error: cannot declare field ‘brpc::NsheadClosure::_response’ to be of abstract 
type ‘brpc::NsheadMessage’
      67 |     NsheadMessage _response;
         |                   ^~~~~~~~~
   ```
   I did some investigation and found the cause of the error is the class 
`Message` in `protobuf` was changed to virtual. The related codes in protobuf: 
_src/google/protobuf/message.h Line 251_
   ```
     // Construct a new instance on the arena. Ownership is passed to the caller
     // if arena is a nullptr.
     Message* New(Arena* arena) const override = 0;
   ```
   The original codes:
   ```
     // Construct a new instance on the arena. Ownership is passed to the caller
     // if arena is a nullptr. Default implementation allows for API 
compatibility
     // during the Arena transition.
     Message* New(Arena* arena) const override {
       Message* message = New();
       if (arena != nullptr) {
         arena->Own(message);
       }
       return message;
     }
   ```
   Could you help confirm and resolve this issue? Thanks in advance.
   The related PR on VCPKG: https://github.com/microsoft/vcpkg/pull/21485
   The full fail log: 
[install-x64-linux-dbg-out.log](https://github.com/apache/incubator-brpc/files/7894097/install-x64-linux-dbg-out.log)
   
   **To Reproduce (复现方法)**
   
   
   **Expected behavior (期望行为)**
   
   
   **Versions (各种版本)**
   OS: Windows 10
   Compiler: Visual Studio 2019
   brpc: 0.9.7
   protobuf: 3.19.3
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to